You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
amespaceDeafMan1983.Interop.X11;[NativeTypeName("typedef unsigned long XID")]publicreadonlystructXID{publicreadonlynuintHandle;publicXID(nuintvalue){Handle=value;}publicstaticexplicitoperatorXID(nuintvalue)=>newXID(value);publicstaticimplicitoperatornuint(XIDxid)=>xid.Handle;}
namespaceDeafMan1983.X11Test;usingDeafMan1983.Interop.X11;usingstaticDeafMan1983.Interop.X11.X11;usingstaticDeafMan1983.ConvFunctions;unsafeclassProgram{staticintMain(string[]args){try{if(args.Length==1&&args[0]=="--version"){Console.WriteLine(@" CopyRight 2023, Jens-Peter Eckervogt, aka DeafMan1983, Germany Author: Jens-Peter Eckervogt Description: This app was written in C#. ");}else{Display*display=XOpenDisplay(null);if(display==null){Console.WriteLine("Error: Initializing X11!");return-1;}intscr_nbr=XDefaultScreen(display);intscreen_width=XDisplayWidth(display,scr_nbr);intscreen_height=XDisplayHeight(display,scr_nbr);intwin_w=400;intwin_h=400;Windowwin=XCreateSimpleWindow(display,XRootWindow(display,scr_nbr),0,0,(uint)win_w,(uint)win_h,0,XBlackPixel(display,scr_nbr),XWhitePixel(display,scr_nbr));if(win==NULL){Console.WriteLine("Error: Creating X11's Window");return-1;}XSelectInput(display,win,KeyPressMask|ExposureMask|SubstructureRedirectMask);Atomwm_protocol=XInternAtom(display,SBytePointerFromString("WM_PROTOCOLS"),False);Atomwm_delete_window=XInternAtom(display,SBytePointerFromString("WM_DELETE_WINDOW"),False);XSetWMProtocols(display,win,&wm_delete_window,1);XStoreName(display,win,SBytePointerFromString("Hello X11 Window"));XMapWindow(display,win);intcenter_w=(screen_width-win_w)/2;intcenter_h=(screen_height-win_h)/2;XMoveWindow(display,win,center_w,center_h);XFlush(display);GC*gc=XDefaultGC(display,scr_nbr);constintstep=15;constintrects_number=40;XRectangle[]rectangles=newXRectangle[rects_number];XEventevt;while(true){XNextEvent(display,&evt);if(evt.type==KeyPress){if(evt.xkey.keycode==0x09){break;}}if(evt.type==ClientMessage){if(evt.xclient.message_type==wm_protocol&&evt.xclient.data.l[0]==wm_delete_window){break;}}if(evt.type==Expose&&evt.xexpose.count==0){for(inti=0;i<rects_number;i++){rectangles[i].x=(short)(i*step);rectangles[i].y=(short)(i*step);rectangles[i].width=step*2;rectangles[i].height=step*2;}
fixed (XRectangle*rectPtr=rectangles){XDrawRectangles(display,win,gc,rectPtr,rects_number);}}}XDestroyWindow(display,win);XCloseDisplay(display);}}catch(Exceptionexc){Console.WriteLine("Error: {0}",exc.Message);}return0;}}
I would like to show you.
No problem for me! I saw in repository and your structures's implicit and explicit are wrong because you won't to write Handle indeed of Window or Drawable or you check if (window = NULL) { ... }
NULL is XID for XID-used structures and if you ATOM, Font or GContext cast with (long) or (nuint) with XID's NULL.
I write simple XID's NULL:
// Hack trick: It just is a NULL == null.publicreadonlystaticXIDNULL=newXID(0);
Have nice weekend and merry Christmas!
The text was updated successfully, but these errors were encountered:
DeafMan1983
added
proposal
An issue that represents a proposed feature or change to the repo.
untriaged
An issue that has not been triaged by the repo maintainers.
labels
Dec 10, 2023
DeafMan1983
changed the title
Why do you replace void* for Drawable,
Why do you replace void* for Drawable, Pixmap, Window or other?
Dec 10, 2023
#Replace
void*
withnuint
I have resolved with Window.cs from my own.
And example with Drawable
And Window.
Result:
It works fine like original X11 C <-> C#
I would like to show you.
No problem for me! I saw in repository and your structures's implicit and explicit are wrong because you won't to write
Handle
indeed ofWindow
orDrawable
or you checkif (window = NULL) { ... }
NULL is XID for XID-used structures and if you
ATOM
,Font
orGContext
cast with(long)
or(nuint)
with XID's NULL.I write simple XID's NULL:
Have nice weekend and merry Christmas!
The text was updated successfully, but these errors were encountered: