version 1.61, 2017/08/21 09:06:02
|
version 1.66, 2017/08/24 08:26:43
|
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 66 encart(struct_processus *s_etat_processu
|
Line 84 encart(struct_processus *s_etat_processu
|
int y_max; |
int y_max; |
int y_min; |
int y_min; |
|
|
Pixel couleur_arriere_plan; |
|
Pixel couleur_avant_plan; |
|
|
|
Pixmap pixmap_rpl; |
Pixmap pixmap_rpl; |
Pixmap pixmap_rpl_masque; |
Pixmap pixmap_rpl_masque; |
|
|
Line 102 encart(struct_processus *s_etat_processu
|
Line 117 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 135 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); |
|
|
|
XtVaGetValues(objet_principal, |
|
XmNmwmDecorations, &decor, |
|
XmNmwmFunctions, &fonctions, |
|
NULL); |
|
|
|
decor &= ~(MWM_DECOR_ALL + MWM_DECOR_MAXIMIZE + MWM_DECOR_RESIZEH |
|
+ MWM_DECOR_TITLE + MWM_DECOR_MENU + MWM_DECOR_BORDER); |
|
fonctions &= ~(MWM_FUNC_ALL + MWM_FUNC_RESIZE + MWM_FUNC_CLOSE |
|
+ MWM_FUNC_MINIMIZE + MWM_FUNC_MAXIMIZE); |
|
|
|
XtVaSetValues(objet_principal, |
|
XmNmwmDecorations, decor, |
|
XmNmwmFunctions, fonctions, |
|
NULL); |
|
|
cadre = XtVaCreateManagedWidget("rplExternalFrame", |
cadre = XtVaCreateManagedWidget("rplExternalFrame", |
xmFrameWidgetClass, form, |
xmFrameWidgetClass, form, |
XmNtopAttachment, XmATTACH_FORM, |
XmNtopAttachment, XmATTACH_FORM, |
Line 139 encart(struct_processus *s_etat_processu
|
Line 173 encart(struct_processus *s_etat_processu
|
XmNmarginHeight, 5, |
XmNmarginHeight, 5, |
NULL); |
NULL); |
|
|
XtVaGetValues(form, |
uprintf("0\n"); |
XmNforeground, &couleur_avant_plan, |
if ((erreur = XpmCreatePixmapFromData(XtDisplay(form), |
XmNbackground, &couleur_arriere_plan, |
|
NULL); |
|
|
|
if ((erreur = XCreatePixmapFromData(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 158 encart(struct_processus *s_etat_processu
|
Line 188 encart(struct_processus *s_etat_processu
|
XmNlabelPixmap, pixmap_rpl, |
XmNlabelPixmap, pixmap_rpl, |
NULL); |
NULL); |
|
|
XtVaGetValues(objet_principal, |
uprintf("1\n"); |
XmNmwmDecorations, &decor, |
|
XmNmwmFunctions, &fonctions, |
|
NULL); |
|
|
|
decor &= ~(MWM_DECOR_ALL + MWM_DECOR_MAXIMIZE + MWM_DECOR_RESIZEH |
|
+ MWM_DECOR_TITLE + MWM_DECOR_MENU + MWM_DECOR_BORDER); |
|
fonctions &= ~(MWM_FUNC_ALL + MWM_FUNC_RESIZE + MWM_FUNC_CLOSE |
|
+ MWM_FUNC_MINIMIZE + MWM_FUNC_MAXIMIZE); |
|
|
|
XtVaSetValues(objet_principal, |
|
XmNmwmDecorations, decor, |
|
XmNmwmFunctions, fonctions, |
|
NULL); |
|
|
|
if (XineramaIsActive(display) == True) |
if (XineramaIsActive(display) == True) |
{ |
{ |
// Récupération de la localisation des différents écrans |
// Récupération de la localisation des différents écrans |
Line 180 encart(struct_processus *s_etat_processu
|
Line 196 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 208 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 259 encart(struct_processus *s_etat_processu
|
Line 281 encart(struct_processus *s_etat_processu
|
offset_x = 0; |
offset_x = 0; |
offset_y = 0; |
offset_y = 0; |
} |
} |
|
uprintf("2\n"); |
XCloseDisplay(display); |
|
|
|
#if 0 |
#if 0 |
XtRealizeWidget(objet_principal); |
XtRealizeWidget(objet_principal); |
Line 287 encart(struct_processus *s_etat_processu
|
Line 308 encart(struct_processus *s_etat_processu
|
|
|
XtRealizeWidget(objet_principal); |
XtRealizeWidget(objet_principal); |
#endif |
#endif |
|
uprintf("3\n"); |
|
|
XFlush(XtDisplay(form)); |
XFlush(XtDisplay(form)); |
|
uprintf("3a\n"); |
|
|
attente.tv_sec = 0; |
attente.tv_sec = 0; |
attente.tv_nsec = 1000; |
attente.tv_nsec = 1000; |
Line 297 encart(struct_processus *s_etat_processu
|
Line 320 encart(struct_processus *s_etat_processu
|
|
|
do |
do |
{ |
{ |
|
uprintf("3b\n"); |
if (XtAppPending(app) != 0) |
if (XtAppPending(app) != 0) |
{ |
{ |
|
uprintf("3c\n"); |
XtAppNextEvent(app, &evenement); |
XtAppNextEvent(app, &evenement); |
|
uprintf("3d\n"); |
XtDispatchEvent(&evenement); |
XtDispatchEvent(&evenement); |
|
uprintf("3e\n"); |
} |
} |
|
uprintf("3f\n"); |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
gettimeofday(&horodatage_final, NULL); |
gettimeofday(&horodatage_final, NULL); |
Line 320 encart(struct_processus *s_etat_processu
|
Line 348 encart(struct_processus *s_etat_processu
|
+ ((double) temps_ecoule.tv_sec)) |
+ ((double) temps_ecoule.tv_sec)) |
< (((double) duree) / ((double) 1000000))); |
< (((double) duree) / ((double) 1000000))); |
|
|
|
uprintf("4\n"); |
XtUnrealizeWidget(objet_principal); |
XtUnrealizeWidget(objet_principal); |
|
uprintf("5\n"); |
XmDestroyPixmap(XtScreen(form), pixmap_rpl); |
|
XmDestroyPixmap(XtScreen(form), pixmap_rpl_masque); |
|
|
|
XtDestroyWidget(pixmap); |
|
XtDestroyWidget(cadre); |
|
XtDestroyWidget(form); |
|
XtDestroyWidget(objet_principal); |
|
|
|
while(XtAppPending(app) == 0) |
while(XtAppPending(app) == 0) |
{ |
{ |
Line 342 encart(struct_processus *s_etat_processu
|
Line 364 encart(struct_processus *s_etat_processu
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
} |
} |
|
|
|
XtDestroyWidget(pixmap); |
|
XtDestroyWidget(cadre); |
|
XtDestroyWidget(form); |
|
XtDestroyWidget(objet_principal); |
|
|
|
uprintf("6\n"); |
|
XmDestroyPixmap(XtScreen(form), pixmap_rpl); |
|
XmDestroyPixmap(XtScreen(form), pixmap_rpl_masque); |
|
|
|
XtAppSetWarningHandler(app, old_message_handler); |
XtDestroyApplicationContext(app); |
XtDestroyApplicationContext(app); |
|
XCloseDisplay(display); |
|
uprintf("7\n"); |
} |
} |
# endif |
# endif |
|
|