Changeset 1263 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Oct 31, 2000, 9:40:50 AM (25 years ago)
Author:
ercodmgr
Message:

Tentative de capture de CloseWindow sur la fenetre principale - Reza 31/10/2000

Location:
trunk/SophyaPI/PI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/Tests/pit0.cc

    r366 r1263  
    227227char strg[64];
    228228
     229 printf("DBG-PITApp::Process() Msg= %d (%d - %d) Sender=%lx (This=%lx) \n",
     230        (int)msg, (int)UserMsg(msg),(int)ModMsg(msg), (long)sender, (long)this);
     231
    229232// Gestion des actions en fonctions des messages
    230233
  • trunk/SophyaPI/PI/Tests/pitgr.cc

    r458 r1263  
    113113int i,j;
    114114
     115 printf("DBG-PITApp::Process() Msg= %d (%d - %d) Sender=%lx (This=%lx) \n",
     116        (int)msg, (int)UserMsg(msg),(int)ModMsg(msg), (long)sender, (long)this);
     117
    115118if ( ( ModMsg(msg) == PIMsg_Active) || (ModMsg(msg) == PIMsg_Close) ) {
    116119  PIWdg *sndw;
     
    122125      mCurW = NULL; }
    123126    else  mCurW = (PIWindow *)sender;
     127  }
     128  else if (sender == this) {
     129    printf(" PIMsg_Close from Application !!! \n");
     130    return;
    124131  }
    125132}
     
    369376
    370377    default :
    371 //      printf("PITApp::Process() Msg= %d (%d - %d)??? \n",
    372 //            (int)msg, (int)UserMsg(msg),(int)ModMsg(msg));
     378      printf("PITApp::Process() Msg= %d (%d - %d)??? \n",
     379            (int)msg, (int)UserMsg(msg),(int)ModMsg(msg));
    373380     break;
    374381    }
     
    402409app->Run();
    403410
     411 printf("Apres app->Run(); \n");
    404412delete cmap;
    405413delete app;
  • trunk/SophyaPI/PI/piapplx.cc

    r1133 r1263  
    22#include <X11/cursorfont.h>
    33#include <X11/IntrinsicP.h>
     4#include <X11/Shell.h>
     5#include <X11/StringDefs.h>
     6#include <Xm/Xm.h>
    47#include "piapplx.h"
    58#include "picontainerx.h"
     
    7982{
    8083}
     84
     85// ---------------------------------------------
     86// Fonction pour gestion des close-window
     87
     88/* Nouvelle-Fonction */
     89static int fgactl = 0;
     90
     91static void CloseWindow (Widget w, XEvent*, String*,Cardinal*)
     92{
     93XtCallCallbacks(w,  XtNpopdownCallback, NULL);
     94}
     95
     96/* Nouvelle-Fonction */
     97static void popdwn_cb_app(Widget /*w*/, XtPointer *usd,  XtPointer * )
     98{
     99PIApplicationX * app = (PIApplicationX *) usd;
     100app->SendSelf(0,PIMsg_Close, NULL) ;
     101}
     102
    81103
    82104/* --Methode-- */
     
    134156
    135157topwdg->Manage();
     158
     159// ------------------------------------------------------
     160//   Pour la gestion des close window des Window manager
     161
     162if (fgactl == 0)    {
     163  XtActionsRec desact = {(char *)"CloseWindow" ,CloseWindow};
     164  int szx, szy, szf;
     165  XtAppContext * appctx = PIXtAppCtx(szx, szy, szf);
     166  XtAppAddActions(*appctx, &desact, 1); 
     167  Display *mdsp;
     168  mdsp = XtDisplay (topwdg->XtWdg());
     169  Atom wmd;
     170  wmd = XInternAtom(mdsp, "WM_DELETE_WINDOW",False);
     171  XSetWMProtocols(mdsp, XtWindow(topwdg->XtWdg()), &wmd, 1);
     172  fgactl = 1;
     173}
     174
     175XtTranslations trans;
     176trans = XtParseTranslationTable("<Message>WM_PROTOCOLS:CloseWindow()");
     177XtOverrideTranslations(topwdg->XtWdg() , trans);
     178Arg warg[2];
     179XtSetArg(warg[0], XmNdeleteResponse, XmDO_NOTHING);
     180XtSetValues(topwdg->XtWdg(), warg, 1);
     181
     182XtAddCallback(topwdg->XtWdg(), XtNpopdownCallback,
     183              (XtCallbackProc)popdwn_cb_app, (XtPointer)this);
     184
     185// ------------------------------------------------------
     186
    136187cur_piapp = this;
    137188mState = -1;
  • trunk/SophyaPI/PI/piversion.h

    r1124 r1263  
    22#define PIVERSION_H_SEEN
    33
    4 #define PI_VERSIONNUMBER  2.7
     4#define PI_VERSIONNUMBER  2.72
    55
    66#endif
  • trunk/SophyaPI/PI/piwindowx.cc

    r425 r1263  
    2020}
    2121
    22 
    23 /* Nouvelle-Fonction */
    24 static int fgactl = 0;
    25 
    26 static void CloseWindow (Widget w, XEvent*, String*,Cardinal*)
    27 {
    28 XtCallCallbacks(w,  XtNpopdownCallback, NULL);
    29 }
    3022
    3123/* *** ATTENTION *** La constante ci-dessous PIXMFORMFRACBASE
     
    8072                (XtCallbackProc)popdwn_cb, (XtPointer)this);
    8173
    82   if (fgactl == 0)
    83     {
    84     XtActionsRec desact = {(char *)"CloseWindow" ,CloseWindow};
    85     int szx, szy, szf;
    86     XtAppContext * appctx = PIXtAppCtx(szx, szy, szf);
    87     XtAppAddActions(*appctx, &desact, 1);  fgactl = 1;
    88     }
    8974
    9075  trans = XtParseTranslationTable("<Message>WM_PROTOCOLS:CloseWindow()");
Note: See TracChangeset for help on using the changeset viewer.