Diff for /rpl/src/encart.c between versions 1.61 and 1.63

version 1.61, 2017/08/21 09:06:02 version 1.63, 2017/08/23 20:29:29
Line 29 Line 29
 #   include <X11/extensions/Xinerama.h>  #   include <X11/extensions/Xinerama.h>
 #endif  #endif
   
   static logical1
   valeur_erreur(logical1 nouvelle_valeur)
   {
       static logical1 erreur = d_faux;
       logical1        registre;
   
       registre = erreur;
       erreur = nouvelle_valeur;
       return(registre);
   }
   
 static int  static int
 _XlibErrorHandler(Display *display, XErrorEvent *event)  _XlibErrorHandler(Display *display, XErrorEvent *event)
 {  {
       valeur_erreur(d_vrai);
     uprintf("An error occured detecting the mouse position\n");      uprintf("An error occured detecting the mouse position\n");
     return True;      return True;
 }  }
   
   static void
   _XtWarningHandler(String message)
   {
       return;
   }
   
 void  void
 encart(struct_processus *s_etat_processus, integer8 duree)  encart(struct_processus *s_etat_processus, integer8 duree)
 {  {
Line 102  encart(struct_processus *s_etat_processu Line 120  encart(struct_processus *s_etat_processu
   
     XtAppContext        app;      XtAppContext        app;
   
       XtErrorHandler      old_message_handler;
   
     if (strstr(XmVERSION_STRING, "LessTif") != NULL)      if (strstr(XmVERSION_STRING, "LessTif") != NULL)
     {      {
         printf("Lesstif is broken, please consider an upgrade to OpenMotif.\n");          printf("Lesstif is broken, please consider an upgrade to OpenMotif.\n");
Line 118  encart(struct_processus *s_etat_processu Line 138  encart(struct_processus *s_etat_processu
     if (display != NULL)      if (display != NULL)
     {      {
         objet_principal = XtVaOpenApplication(&app, "rpl",          objet_principal = XtVaOpenApplication(&app, "rpl",
                 NULL, 0, &argc, argv, NULL, topLevelShellWidgetClass, NULL);                  NULL, 0, &argc, argv, NULL, overrideShellWidgetClass, NULL);
         XSynchronize(XtDisplay(objet_principal), False);          XSynchronize(XtDisplay(objet_principal), False);
   
           old_message_handler = XtAppSetWarningHandler(app, _XtWarningHandler);
   
         form = XtVaCreateManagedWidget("rplSplashScreen",          form = XtVaCreateManagedWidget("rplSplashScreen",
                 xmFormWidgetClass, objet_principal,                  xmFormWidgetClass, objet_principal,
                 NULL);                  NULL);
Line 144  encart(struct_processus *s_etat_processu Line 166  encart(struct_processus *s_etat_processu
                 XmNbackground, &couleur_arriere_plan,                  XmNbackground, &couleur_arriere_plan,
                 NULL);                  NULL);
   
         if ((erreur = XCreatePixmapFromData(XtDisplay(form),          if ((erreur = XpmCreatePixmapFromData(XtDisplay(form),
                 DefaultRootWindow(XtDisplay(form)), rpl_xpm,                  DefaultRootWindow(XtDisplay(form)), rpl_xpm,
                 &pixmap_rpl, &pixmap_rpl_masque, NULL)) != 0)                  &pixmap_rpl, &pixmap_rpl_masque, NULL)) != 0)
         {          {
Line 180  encart(struct_processus *s_etat_processu Line 202  encart(struct_processus *s_etat_processu
   
             ts = XineramaQueryScreens(display, &ns);              ts = XineramaQueryScreens(display, &ns);
   
             XSetErrorHandler(_XlibErrorHandler);              //XSetErrorHandler(_XlibErrorHandler);
             nb_screens = XScreenCount(display);              nb_screens = XScreenCount(display);
   
             root_windows = sys_malloc(((unsigned) nb_screens) * sizeof(Window));              root_windows = sys_malloc(((unsigned) nb_screens) * sizeof(Window));
Line 192  encart(struct_processus *s_etat_processu Line 214  encart(struct_processus *s_etat_processu
   
             for(i = 0; i < nb_screens; i++)              for(i = 0; i < nb_screens; i++)
             {              {
                 if ((mouse_found = XQueryPointer(display, root_windows[i],                  valeur_erreur(d_faux);
                         &window_returned, &window_returned,  
                         &root_x, &root_y, &win_x, &win_y, &mask_return))                  do
                         == True)                  {
                       mouse_found = XQueryPointer(display, root_windows[i],
                               &window_returned, &window_returned,
                               &root_x, &root_y, &win_x, &win_y, &mask_return);
                   } while(valeur_erreur(d_faux) == d_vrai);
   
                   if (mouse_found == True)
                 {                  {
                     break;                      break;
                 }                  }
Line 260  encart(struct_processus *s_etat_processu Line 288  encart(struct_processus *s_etat_processu
             offset_y = 0;              offset_y = 0;
         }          }
   
         XCloseDisplay(display);  
   
 #if 0  #if 0
         XtRealizeWidget(objet_principal);          XtRealizeWidget(objet_principal);
   
Line 342  encart(struct_processus *s_etat_processu Line 368  encart(struct_processus *s_etat_processu
             nanosleep(&attente, NULL);              nanosleep(&attente, NULL);
         }          }
   
           XCloseDisplay(display);
           XtAppSetWarningHandler(app, old_message_handler);
         XtDestroyApplicationContext(app);          XtDestroyApplicationContext(app);
     }      }
 #   endif  #   endif

Removed from v.1.61  
changed lines
  Added in v.1.63


CVSweb interface <joel.bertrand@systella.fr>