ui/motif/window.c

changeset 934
89118a9350da
parent 933
70e14fa98ab4
child 986
6f7600c2b9e1
--- a/ui/motif/window.c	Sun Nov 23 11:21:17 2025 +0100
+++ b/ui/motif/window.c	Sun Nov 23 14:52:41 2025 +0100
@@ -179,6 +179,32 @@
     }
 }
 
+static Atom net_wm_state;
+static Atom net_wm_state_fullscreen;
+static int net_wm_atoms_initialized = 0;
+
+void ui_window_fullscreen(UiObject *obj, UiBool fullscreen) {
+    Display *dpy = XtDisplay(obj->widget);
+    
+    // init net_wm_state atoms
+    if(!net_wm_atoms_initialized) {
+        net_wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
+        net_wm_state_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+        net_wm_atoms_initialized = 1;
+    }
+    
+    XEvent ev;
+    memset(&ev, 0, sizeof(XEvent));
+    ev.type = ClientMessage;
+    ev.xclient.window = XtWindow(obj->widget);
+    ev.xclient.message_type = net_wm_state;
+    ev.xclient.format = 32;
+    ev.xclient.data.l[0] = fullscreen ? 1 : 0;
+    ev.xclient.data.l[1] = net_wm_state_fullscreen;
+    ev.xclient.data.l[2] = 0;
+    XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureNotifyMask | SubstructureRedirectMask, &ev);
+}
+
 static void filedialog_event(UiEventData *event, int result, UiFileList flist) {
     UiEvent evt;
     evt.obj = event->obj;

mercurial