From 0943f1ae7a28e90c02aec02acedb9dc193c4236e Mon Sep 17 00:00:00 2001 From: fredvs Date: Mon, 20 Jun 2022 04:58:07 +0200 Subject: [PATCH] Added window options: wo_transparentbackgroundround ,wo_inalldesktops. --- lib/common/kernel/linux/mseguiintf.pas | 73 +++++++++++++++++++++--- lib/common/kernel/mseguiglob.pas | 6 +- lib/common/kernel/windows/mseguiintf.pas | 34 ++++++++++- 3 files changed, 103 insertions(+), 10 deletions(-) diff --git a/lib/common/kernel/linux/mseguiintf.pas b/lib/common/kernel/linux/mseguiintf.pas index aaad3d6fd..04791bd05 100644 --- a/lib/common/kernel/linux/mseguiintf.pas +++ b/lib/common/kernel/linux/mseguiintf.pas @@ -970,7 +970,7 @@ procedure setmsestringproperty(id: winidty; prop: atom; const value: msestring); end; procedure setwinidproperty(id: winidty; prop: atom; value: winidty); -begin + begin {$ifdef mse_debuggdisync} checkgdilock; {$endif} @@ -1652,8 +1652,8 @@ function gui_getwindowdesktop(const id: winidty): integer; begin result:= 0; if getnetcardinal(id,net_wm_desktop,lwo1) then begin - result:= lwo1; - end; + result:= lwo1; +end; end; function changenetwmstate(id: winidty; const operation: netwmstateoperationty; @@ -4062,6 +4062,8 @@ function gui_createwindow(const rect: rectty; icmask: longword; colormap1: tcolormap; opt1: windowtypeoptionty; + valall: ptruint; + // shape from Xext xgcv :TXGCValues; pmap : pixmapty; @@ -4129,7 +4131,7 @@ function gui_createwindow(const rect: rectty; setnetatomarrayitem(id,net_wm_state,net_wm_alwaystofront); if (mse_hasxext = true) and ((wo_rounded in options.options) or (wo_ellipse in options.options) - or (wo_transparentbackground in options.options)) then + or (wo_transparentbackground in options.options) or (wo_transparentbackgroundround in options.options)) then begin // shape //* create a graphics context for drawing on the window */ @@ -4176,6 +4178,56 @@ function gui_createwindow(const rect: rectty; end; end; end else + if (wo_transparentbackgroundround in options.options) then + begin + if length(mse_formchild) = 0 then + begin + XDrawRectangle(appdisp, pmap, shape_gc, 0, 0, Width, Height); + XFillRectangle(appdisp, pmap, shape_gc, 0, 0, Width, Height); + end else + begin + for x := 0 to length(mse_formchild) - 1 do + begin + XDrawarc(appdisp, pmap, shape_gc, mse_formchild[x].left, mse_formchild[x].top, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].top, 360*64); + XFillarc(appdisp, pmap, shape_gc, mse_formchild[x].left, mse_formchild[x].top, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].top, 360*64); + + XDrawarc(appdisp, pmap, shape_gc, mse_formchild[x].left + mse_formchild[x].Width - mse_radiuscorner, mse_formchild[x].top, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].top, 360*64); + XFillarc(appdisp, pmap, shape_gc, mse_formchild[x].left + mse_formchild[x].Width - mse_radiuscorner, mse_formchild[x].top, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].top, 360*64); + + XDrawarc(appdisp, pmap, shape_gc, mse_formchild[x].left, + mse_formchild[X].Height + mse_formchild[x].top - mse_radiuscorner -1, + mse_radiuscorner-1 , mse_radiuscorner, mse_formchild[x].left, 360*64); + XFillarc(appdisp, pmap, shape_gc, mse_formchild[x].left, + mse_formchild[X].Height + mse_formchild[x].top - mse_radiuscorner -1, + mse_radiuscorner-1 , mse_radiuscorner, mse_formchild[x].left, 360*64); + + XDrawarc(appdisp, pmap, shape_gc, mse_formchild[x].left + mse_formchild[x].Width - mse_radiuscorner, + mse_formchild[X].Height + mse_formchild[x].top - mse_radiuscorner -1, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].left, 360*64); + + XFillarc(appdisp, pmap, shape_gc, mse_formchild[x].left + mse_formchild[x].Width - mse_radiuscorner, + mse_formchild[X].Height + mse_formchild[x].top - mse_radiuscorner -1, + mse_radiuscorner , mse_radiuscorner, mse_formchild[x].left, 360*64); + + XDrawRectangle(appdisp, pmap, shape_gc,mse_formchild[x].left + (mse_radiuscorner div 2), + mse_formchild[x].top, mse_formchild[x].Width - (mse_radiuscorner) , mse_formchild[X].Height); + + XFillRectangle(appdisp, pmap, shape_gc,mse_formchild[x].left + (mse_radiuscorner div 2), + mse_formchild[x].top, mse_formchild[x].Width - (mse_radiuscorner) , mse_formchild[X].Height); + + + XDrawRectangle(appdisp, pmap, shape_gc, mse_formchild[x].left, mse_formchild[x].top + (mse_radiuscorner div 2), + mse_formchild[x].Width, mse_formchild[X].Height - (mse_radiuscorner)); + + XFillRectangle(appdisp, pmap, shape_gc, mse_formchild[x].left, mse_formchild[x].top + (mse_radiuscorner div 2), + mse_formchild[x].Width, mse_formchild[X].Height - (mse_radiuscorner)); + end; + end; + end else if (wo_rounded in options.options) then begin XDrawarc(appdisp, pmap, shape_gc, 0, 0, mse_radiuscorner , mse_radiuscorner, 0, 360*64); @@ -4200,7 +4252,7 @@ function gui_createwindow(const rect: rectty; XShapeCombineMask(appdisp, id, ShapeBounding, 0, 0, pmap, ShapeSet); XFreePixmap(appdisp, pmap); - + //* register events: ExposureMask for re-drawing, ButtonPressMask // to capture mouse button press events */ @@ -4211,7 +4263,14 @@ function gui_createwindow(const rect: rectty; // fin shape end; - + + if (wo_inalldesktops in options.options) then + begin + options.options := options.options + [wo_dock]; + valall := $FFFFFFFF; + xchangeproperty(appdisp,id,netatoms[NET_WM_DESKTOP],cardinalatom,32,propmodereplace,@valall,1); + end; + if colormap <> 0 then begin xfreecolormap(appdisp,colormap); colormap:= 0; @@ -4312,7 +4371,7 @@ function gui_createwindow(const rect: rectty; end; end; - gdi_unlock; + gdi_unlock; end; diff --git a/lib/common/kernel/mseguiglob.pas b/lib/common/kernel/mseguiglob.pas index b36504c95..cfb14de29 100644 --- a/lib/common/kernel/mseguiglob.pas +++ b/lib/common/kernel/mseguiglob.pas @@ -134,7 +134,9 @@ keyeventinfoty = record wo_alwaysontop, wo_ellipse, wo_rounded, - wo_transparentbackground + wo_transparentbackground, + wo_transparentbackgroundround, + wo_inalldesktops ); windowoptionsty = set of windowoptionty; windowtypeoptionty = wo_popup..wo_dnd; @@ -323,7 +325,7 @@ egui = class(eerror) noreconfigurewmwindow: boolean; toplevelraise: boolean; nostaticgravity: boolean; - mse_radiuscorner : integer = 22; + mse_radiuscorner : integer = 8; // exabug: boolean; // nocreatestaticgravity: boolean; diff --git a/lib/common/kernel/windows/mseguiintf.pas b/lib/common/kernel/windows/mseguiintf.pas index 35ffdfc4c..fbe051430 100644 --- a/lib/common/kernel/windows/mseguiintf.pas +++ b/lib/common/kernel/windows/mseguiintf.pas @@ -2954,6 +2954,10 @@ function gui_createwindow(const rect: rectty; windowstyleex:= windowstyleex or ws_ex_noactivate; end; + if wo_inalldesktops in options then begin + windowstyleex:= windowstyleex or WS_EX_TOOLWINDOW ; + end; + // Thanks to Alexander. if wo_alwaysontop in options then begin windowstyleex:= windowstyleex or WS_EX_TOPMOST; @@ -3077,8 +3081,36 @@ function gui_createwindow(const rect: rectty; SetWindowRgn(id, region, True); DeleteObject(region2); DeleteObject(region); + end else + if wo_transparentbackgroundround in options then + begin + if length(mse_formchild) = 0 then + begin + region := CreateRoundRectRgn(0,0, rect1.cx, rect1.cy - 1, mse_radiuscorner, mse_radiuscorner); + end else + begin + region := CreateRoundRectRgn(0, 0, 0, 0, 0, 0); + + deco_y := GetSystemMetrics(SM_CYFRAME)+ + GetSystemMetrics(SM_CYCAPTION); + + deco_x := GetSystemMetrics(SM_CXFRAME); + + application.processmessages; + + for x := 0 to length(mse_formchild) - 1 do + begin + region2 := CreateRoundRectRgn(mse_formchild[x].left + deco_x,mse_formchild[x].top + deco_y, + mse_formchild[x].left + mse_formchild[x].Width + deco_x, + mse_formchild[x].top + mse_formchild[x].height + deco_y, + mse_radiuscorner, mse_radiuscorner); + CombineRgn(region, region, region2, RGN_OR); + end; + end; + SetWindowRgn(id, region, True); + DeleteObject(region2); + DeleteObject(region); end; - if not (pos = wp_default) and (parent = 0) then begin result:= gui_reposwindow(id,rect);