@@ -344,6 +344,7 @@ x11internalwindowoptionsty = record
344344 XC_watch = 150 ;
345345 XC_xterm = 152 ;
346346
347+ { $if not defined(use_xcb)}
347348 { $ifdef darwin}
348349 Xlibmodulename = ' libX11.dylib' ;
349350 { $else}
@@ -352,9 +353,10 @@ x11internalwindowoptionsty = record
352353 { $else}
353354 Xlibmodulename = ' libX11.so.6' ;
354355 { $endif}
356+ { $endif}
357+ sXlib = Xlibmodulename;
355358 { $endif}
356359
357- sXlib = Xlibmodulename;
358360 pixel0 = $000000 ;
359361 pixel1 = $ffffff;
360362type
@@ -559,8 +561,8 @@ tcanvas1 = class(tcanvas);
559561 { $define xtextproperty:= txtextproperty}
560562 { $define xcolor:= txcolor}
561563 { $define xpointer:= txpointer}
562- TXIMProc = procedure (para1:PXIM; para2:XPointer; para3:XPointer);cdecl;
563564
565+ TXIMProc = procedure (para1:PXIM; para2:XPointer; para3:XPointer);cdecl;
564566 TXICProc = function (para1:PXIC; para2:XPointer; para3:XPointer):TBool;cdecl;
565567 PXIMCallback = ^TXIMCallback;
566568 TXIMCallback = record
@@ -583,7 +585,6 @@ TXIM = record
583585 TXIC = record
584586 end ;
585587 TXIMProc = procedure (para1:TXIM; para2:XPointer; para3:XPointer);cdecl;
586-
587588 TXICProc = function (para1:TXIC; para2:XPointer; para3:XPointer):TBool;cdecl;
588589 PXIMCallback = ^TXIMCallback;
589590 TXIMCallback = record
@@ -640,7 +641,6 @@ x11windowty = record
640641 atombits = sizeof(atom)*8 ;
641642 mouseeventmask = buttonpressmask or buttonreleasemask or pointermotionmask;
642643
643-
644644 {
645645 cursorshapety = (cr_default,
646646 cr_none,cr_arrow,cr_cross,cr_wait,cr_ibeam,
@@ -651,6 +651,7 @@ x11windowty = record
651651 cr_res0,cr_res1,cr_res2,cr_res3,cr_res4,cr_res5,cr_res6,cr_res7,
652652 cr_user);
653653 }
654+
654655 defaultshape = xc_left_ptr;
655656 standardcursors: array [cursorshapety] of longword = (
656657 defaultshape,defaultshape,defaultshape,
@@ -889,8 +890,6 @@ procedure usevariables;
889890 end ;
890891end ;
891892
892-
893-
894893function getidnum : longword;
895894begin
896895 result:= interlockedincrement(fidnum);
@@ -1766,6 +1765,8 @@ function gui_setwindowstate(id: winidty; size: windowsizety;
17661765begin
17671766 gdi_lock;
17681767 result:= gue_ok;
1768+
1769+
17691770 if visible then begin
17701771{ $ifdef mse_debugshow}
17711772 debugwindow(' *gui_setwindowstate xmapwindow ' ,id);
@@ -1780,6 +1781,7 @@ function gui_setwindowstate(id: winidty; size: windowsizety;
17801781 xmapwindow(appdisp,id);
17811782 end ;
17821783 end ;
1784+
17831785 if size in [wsi_fullscreen,wsi_fullscreenvirt] then begin
17841786 if not canfullscreen or
17851787 not changenetwmstate(id,nso_add,net_wm_state_fullscreen) then begin
@@ -3192,7 +3194,7 @@ function gui_showwindow(id: winidty): guierrorty;
31923194 bo1: boolean;
31933195begin
31943196 gdi_lock;
3195- xmapwindow(appdisp,id);
3197+ xmapwindow(appdisp,id);
31963198{ $ifdef mse_debugshow}
31973199 debugwindow(' *gui_showwindow ' ,id);
31983200{ $endif}
@@ -3603,7 +3605,7 @@ procedure freeclientevents;
36033605function gui_hasevent : boolean;
36043606begin
36053607 gdi_lock;
3606- result:= ((xpending(appdisp) > 0 ) or timerevent) and not terminated;
3608+ result:= ((xpending(appdisp) > 0 ) or timerevent) and not terminated;
36073609 gdi_unlock;
36083610end ;
36093611
@@ -4018,21 +4020,42 @@ function gui_setwindowgroup(id,group: winidty): guierrorty;
40184020 wmhints: pxwmhints;
40194021begin
40204022 gdi_lock;
4023+ writeln(' gui_setwindowgroup 0' );
40214024{ $ifdef FPC}{ $checkpointer off}{ $endif}
40224025 wmhints:= pxwmhints(xgetwmhints(appdisp,id));
4026+ writeln(' gui_setwindowgroup 1' );
4027+
40234028 if wmhints = nil then begin
4024- wmhints:= pxwmhints(xallocwmhints);
4029+ writeln(' gui_setwindowgroup 2' );
4030+ // fred
4031+ // wmhints:= pxwmhints(xallocwmhints);
4032+ writeln(' gui_setwindowgroup 3' );
40254033 end ;
4034+
40264035 with wmhints^ do begin
4027- window_group:= group;
4028- flags:= flags or windowgrouphint;
4029- xsetwmhints(appdisp,id,wmhints);
4036+ writeln(' gui_setwindowgroup 4' );
4037+ // fred
4038+ // window_group:= group;
4039+ writeln(' gui_setwindowgroup 4.1' );
4040+ // fred
4041+ // flags:= flags or windowgrouphint;
4042+ writeln(' gui_setwindowgroup 4.2' );
4043+ // fred
4044+ // xsetwmhints(appdisp,id,wmhints);
4045+ writeln(' gui_setwindowgroup 5' );
40304046 end ;
4031- xfree(wmhints);
4047+ writeln(' gui_setwindowgroup 6' );
4048+
4049+ // xfree(wmhints);
4050+
4051+ writeln(' gui_setwindowgroup 7' );
40324052{ $ifdef FPC}{ $checkpointer default}{ $endif}
4033- setwinidproperty(id,wmclientleaderatom,group);
4053+ setwinidproperty(id,wmclientleaderatom,group);
4054+
4055+ writeln(' gui_setwindowgroup 8' );
40344056 result:= gue_ok;
40354057 gdi_unlock;
4058+ // fred sleep
40364059end ;
40374060
40384061const
@@ -4132,11 +4155,11 @@ function gui_createwindow(const rect: rectty;
41324155 depth, copyfromparent,visual,
41334156 valuemask,@attributes);
41344157
4135- { $ifdef use_xcb} // fred to test
4136- XMapWindow(appdisp, id);
4137- XFlush(appdisp);
4158+ { $ifdef use_xcb} // fred to test
4159+ // XMapWindow(appdisp, id);
4160+ // XFlush(appdisp);
41384161 { $endif}
4139-
4162+ // sleep(1000);
41404163// ////////////////////////////////////////////
41414164 if (wo_onalldesktops in options.options) then
41424165 begin
@@ -4303,6 +4326,7 @@ function gui_createwindow(const rect: rectty;
43034326
43044327XSelectInput(appdisp, id, ButtonPressMask or ExposureMask);
43054328
4329+ // fred
43064330XMapWindow(appdisp, id);
43074331XSync(appdisp, False);
43084332
@@ -4357,6 +4381,7 @@ function gui_createwindow(const rect: rectty;
43574381 gui_setwindowgroup(id,options.groupleader);
43584382 end ;
43594383 end ;
4384+
43604385 if options.pos <> wp_default then begin
43614386 gui_reposwindow(id,rect);
43624387 end ;
@@ -4369,8 +4394,7 @@ function gui_createwindow(const rect: rectty;
43694394
43704395 writeln(' icmask:= appicmask' );
43714396
4372-
4373- if ic <> nil then begin
4397+ if ic <> nil then begin
43744398 xgeticvalues(ic,pchar(xnfilterevents),@icmask,nil );
43754399 xseticvalues(ic,pchar(xnresetstate),pchar(ximpreservestate),nil );
43764400 end ;
@@ -4415,7 +4439,7 @@ function gui_createwindow(const rect: rectty;
44154439 (netatoms[motif_wm_hints] <> 0 ) then begin
44164440 setlongproperty(id,netatoms[motif_wm_hints],[mwm_hints_decorations,0 ,0 ,0 ,0 ],
44174441 netatoms[motif_wm_hints]);
4418- end ;
4442+ end ;
44194443 if (wo_popup in options.options) then begin
44204444 gui_raisewindow(id);
44214445 end
@@ -4433,8 +4457,10 @@ function gui_createwindow(const rect: rectty;
44334457 end ;
44344458
44354459 end ;
4436- writeln(' fin window ' , gue_ok);
4437- gdi_unlock;
4460+ writeln(' fin window' , gue_ok);
4461+ // sleep(3000);
4462+ gdi_unlock;
4463+
44384464end ;
44394465
44404466
@@ -6171,15 +6197,20 @@ function gui_getevent: tmseevent;
61716197label
61726198 eventrestart;
61736199begin
6174- result:= nil ;
6200+ result:= nil ;
6201+ // fred sleep
6202+
61756203 sigfillset(allsig);
61766204 timeout1.tv_sec:= 10 ;
61776205 timeout1.tv_nsec:= 0 ;
61786206 fdwakeup:= false;
6207+
61796208 while not fdwakeup do begin
61806209 if timerevent then begin
6181- application.postevent(tmseevent.create(ek_timer));
6182- timerevent:= false;
6210+
6211+ application.postevent(tmseevent.create(ek_timer));
6212+ timerevent:= false;
6213+
61836214 end ;
61846215 if terminated then begin
61856216 application.postevent(tmseevent.create(ek_terminate));
@@ -6190,9 +6221,10 @@ function gui_getevent: tmseevent;
61906221 handlesigchld;
61916222 end ;
61926223 if gui_hasevent then begin
6193- break;
6224+ // fred sleep
6225+ break;
61946226 end ;
6195-
6227+
61966228 pthread_sigmask(sig_block,@allsig,@sig1); // block signals
61976229 if not timerevent and not terminated and not childevent then begin
61986230 repeat
@@ -6454,6 +6486,7 @@ function gui_getevent: tmseevent;
64546486 end ;
64556487 end ;
64566488 wms_normal: begin
6489+
64576490 if hasminimizeunmapworkaround and
64586491 (lastmapwindow <> xwindow) then begin
64596492 lastmapwindow:= 0 ;
@@ -6614,6 +6647,8 @@ function gui_getevent: tmseevent;
66146647 xrefreshkeyboardmapping(@xev.xkeymap);
66156648 end ;
66166649 mapnotify: begin
6650+ // fred sleep
6651+
66176652 with xev.xmap do begin
66186653 lastmapwindow:= xwindow;
66196654 result:= twindowevent.create(ek_show,xwindow);
0 commit comments