Hello Axel.

Hum, I think that we will be ready before new release of fpc 3.3.2.

Yep, yep, yep.

I dont have already catched how to draw Xrounded rectangle, here XDrawarc() and 
XFillarc() are used to draw the shape (see picture).
But I think that the final solution is not far.

If you have a idea how to draw a Xrounded rectangle, I am interested 😉, but it 
should not be too difficult, something wit arc + line.

Here the code used in /mseide-msegui/lib/common/kernel/linux/mseguiintf.pas
See code after " if (wo_rounded in options.options)  then begin"
____________________________

function gui_createwindow(const rect: rectty;
     var options: internalwindowoptionsty; var awindow: windowty): guierrorty;
var
 attributes: xsetwindowattributes;
 valuemask: longword;
 width,height: integer;
 id1: winidty;
 icmask: longword;
 colormap1: tcolormap;
 opt1: windowtypeoptionty;
 // shape from Xext
 xgcv :TXGCValues;
 pmap : pixmapty;
 shape_gc : TGC;
 win_gc : TGC;
 begin
 gdi_lock;
 with awindow,x11windowty(platformdata).d do begin
  valuemask:= 0;
  if options.options * [wo_popup,wo_overrideredirect] <> [] then begin
   attributes.override_redirect:= {$ifdef xboolean}true{$else}1{$endif};
   valuemask:= valuemask or cwoverrideredirect;
  end;
  if rect.cx <= 0 then begin
   width:= 1;
  end
  else begin
   width:= rect.cx;
  end;
  if rect.cy <= 0 then begin
   height:= 1;
  end
  else begin
   height:= rect.cy;
  end;
  if options.parent <> 0 then begin
   id1:= options.parent;
  end
  else begin
   id1:= rootid;
  end;
  with x11internalwindowoptionsty(options.platformdata).d do begin
   if colormap <> 0 then begin
    colormap1:= colormap;
   end
   else begin
    colormap1:= msecolormap;
   end;
   if colormap1 <> 0 then begin
    attributes.colormap:= colormap1;
    valuemask:= valuemask or cwcolormap;
   end;
   if depth = 0 then begin
    depth:= copyfromparent;
   end;
   if visual = nil then begin
    visual:= pvisual(copyfromparent);
   end;
//   if nocreatestaticgravity then begin
    attributes.win_gravity:= northwestgravity;
//   end
//   else begin
//    attributes.win_gravity:= staticgravity;
//   end;
   attributes.bit_gravity:= northwestgravity;
   valuemask:= valuemask or cwwingravity or cwbitgravity;

    id:= xcreatewindow(appdisp,id1,rect.x,rect.y,
   width,height,0,
    depth,  copyfromparent,visual,
      valuemask,@attributes);

 if (wo_rounded in options.options)  then
 begin

 // shape
  //* create a graphics context for drawing on the window */

  xgcv.foreground := WhitePixel(appdisp, DefaultScreen(appdisp));
  xgcv.line_width := 1;
  xgcv.line_style := LineSolid;

  win_gc := XCreateGC(appdisp, id, GCForeground or GCLineWidth or GCLineStyle, 
@xgcv);

 //* create the pixmap that we'll use for shaping the window */
  pmap := XCreatePixmap(appdisp, id, width, height, 1);

//* create a graphics context for drawing on the pixmap */
  shape_gc := XCreateGC(appdisp, pmap, 0, @xgcv);

//* shape the window: first blank everything */
XSetForeground(appdisp, shape_gc, 0);
XFillRectangle(appdisp, pmap, shape_gc, 0, 0, width,height);

//* shape the window: now "unblank" everything where we want to draw */

XSetForeground(appdisp, shape_gc, 1);

XDrawarc(appdisp, pmap, shape_gc, 0, 0, width , height,  0, 360*64);

XFillarc(appdisp, pmap, shape_gc, 0, 0, width , height,  0, 360*64);

XShapeCombineMask(appdisp, id, ShapeBounding, 0, 0, pmap, ShapeSet);

XFreePixmap(appdisp, pmap);

//* register events: ExposureMask for re-drawing, ButtonPressMask
// to capture mouse button press events */

XSelectInput(appdisp, id, ButtonPressMask or ExposureMask);

XMapWindow(appdisp, id);
XSync(appdisp, False);

//   end shape
 //   }

end;

   if colormap <> 0 then begin
    xfreecolormap(appdisp,colormap);
    colormap:= 0;
   end;
  end;
  if id = 0 then begin
   result:= gue_createwindow;
   gdi_unlock;
   exit;
  end;
  result:= gue_ok;
  if options.parent <> 0 then begin //embedded window
   xselectinput(appdisp,id,exposuremask); //will be mapped to parent
   gdi_unlock;
   exit;
  end;
  if (options.transientfor <> 0) or
          (options.options * [wo_popup,wo_message] <> []) then begin
   settransientforhint(id,options.transientfor);
  end;
  with options do begin
   if icon <> 0 then begin
    gui_setwindowicon(id,icon,iconmask);
   end;
  end;
  if options.setgroup then begin
   if options.groupleader = 0 then begin
    gui_setwindowgroup(id,id);
   end
   else begin
    gui_setwindowgroup(id,options.groupleader);
   end;
  end;
  if options.pos <> wp_default then begin
   gui_reposwindow(id,rect);
  end;
{           //single ic for whole application
  ic:= xcreateic(im,pchar(xninputstyle),
          ximstatusnothing or ximpreeditnothing,
          pchar(xnclientwindow),id,nil);
}
  icmask:= appicmask;
  if ic <> nil then begin
   xgeticvalues(ic,pchar(xnfilterevents),@icmask,nil);
   xseticvalues(ic,pchar(xnresetstate),pchar(ximpreservestate),nil);
  end;
  xselectinput(appdisp,id,icmask or
              KeymapStateMask or
              KeyPressMask or KeyReleaseMask or
                       buttonpressmask or buttonreleasemask or
                       pointermotionmask or
              EnterWindowMask or LeaveWindowMask or
              FocusChangeMask or PropertyChangeMask or
                       exposuremask or structurenotifymask
                       );
  xsetwmprotocols(appdisp,id,@wmprotocols[low(wmprotocolty)],
              integer(high(wmprotocolty))+1);
  setstringproperty(id,wmclassatom,ansistring(
       filename(sys_getapplicationpath)+#0+application.applicationname));
  setnetcardinal(id,net_wm_pid,getpid);
  if (wo_popup in options.options) and (options.transientfor <> 0) then begin
   gui_raisewindow(options.transientfor);
     //transientforhint not used by overrideredirect
  end;

   // added thanks to Alexander
  if (wo_alwaysontop in options.options)  then
    setnetatomarrayitem(id,net_wm_state,net_wm_alwaystofront);

 if options.options * windowtypeoptions <> [] then begin
   for opt1:= low(windowtypeoptionty) to high(windowtypeoptionty) do begin
    if opt1 in options.options then begin
     setnetatomarrayitem(id,net_wm_window_type,windowtypes[opt1]);
//     break;
    end;

   end;
  end
  else begin
   setnetatomarrayitem(id,net_wm_window_type,net_wm_window_type_normal);
  end;

  if (options.options * noframewindowtypes <> []) and
                           (netatoms[motif_wm_hints] <> 0) then begin
   setlongproperty(id,netatoms[motif_wm_hints],[mwm_hints_decorations,0,0,0,0],
                                                     netatoms[motif_wm_hints]);
  end;
  if (wo_popup in options.options) then begin
   gui_raisewindow(id);
  end
  else begin
   if wo_notaskbar in options.options then begin
//    changenetwmstate(id,nso_add,net_wm_state_skip_taskbar,net_none);
    setnetatomarrayitem(id,net_wm_state,net_wm_state_skip_taskbar);
   end;
  end;
   if wo_sysdnd in options.options then begin
   setatomproperty(id,xdndatoms[xdnd_aware],xdndprotocolversion);
  end
  else begin
   xdeleteproperty(appdisp,id,xdndatoms[xdnd_aware]);
  end;
 end;

 gdi_unlock;
end;






________________________________
De : Alexander via mseide-msegui-talk <[email protected]>
Envoyé : lundi 12 juillet 2021 16:36
À : [email protected] 
<[email protected]>
Cc : Alexander <[email protected]>
Objet : Re: [MSEide-MSEgui-talk] Nikolay Nikolov translated Xext.h to Pascal 
for MSE and FPC team

Thank You Fred,

Yes, sure. In FPC trunk already for all and for future. For MSE immediately.

Good Luck
Alexander.

On Mon, 12 Jul 2021 12:40:38 +0000
Fred van Stappen <[email protected]> wrote:

> Re-hello Alex.
>
> OK, compiled fpc with last commit of Nikolay.
>
> I will jump into new shape.pp things tonight.
>
> About the source of /freepascal/packages/x11/src/ and new Pascal  headers, 
> like shape.pp, maybe we could add that source in msegui source, this to not 
> oblige people to wait for the fpc release 3.3.2 to have msegui shaped form.
>
> Fe;D


_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to