96 lines
2.7 KiB
Text
96 lines
2.7 KiB
Text
$NetBSD: patch-bf,v 1.4 2022/04/24 10:57:28 tnn Exp $
|
|
|
|
Handle always-on-top.
|
|
Fix LP64 problems.
|
|
|
|
--- xutil.c.orig 1999-11-05 00:38:54.000000000 +0000
|
|
+++ xutil.c
|
|
@@ -44,6 +44,7 @@
|
|
#include <X11/Shell.h>
|
|
#include <X11/Xaw/Dialog.h>
|
|
#include <X11/xpm.h>
|
|
+#include "glob.h"
|
|
#include "tvdefines.h"
|
|
#include "xutil.h"
|
|
#include "app_rsrc.h"
|
|
@@ -63,6 +64,10 @@ void XawScrollbarSetThumb( Widget w, flo
|
|
|
|
#define WM_BORDER_PAD 40
|
|
|
|
+#define _NET_WM_STATE_REMOVE 0
|
|
+#define _NET_WM_STATE_ADD 1
|
|
+#define _NET_WM_STATE_TOGGLE 2
|
|
+
|
|
typedef struct {
|
|
pid_t cmd_pid;
|
|
TVUTIL_PIPE_END end[3];
|
|
@@ -371,7 +376,7 @@ TV_BOOL XUTILPixmapLoad( char *pixmap
|
|
XFreePixmap( XtDisplay( wgt ), pixmap_depth1 );
|
|
XFreeGC ( XtDisplay( wgt ), gc );
|
|
if ( pixmap_mask != NULL )
|
|
- *pixmap_mask = NULL;
|
|
+ *pixmap_mask = 0;
|
|
}
|
|
else {
|
|
|
|
@@ -406,11 +411,12 @@ TV_BOOL XUTILPixmapLoad( char *pixmap
|
|
}
|
|
|
|
*pixmap = pix_returned;
|
|
- if ( pix_mask_returned )
|
|
+ if ( pix_mask_returned ) {
|
|
if ( pixmap_mask != NULL )
|
|
*pixmap_mask = pix_mask_returned;
|
|
else
|
|
XFreePixmap( XtDisplay( wgt ), pix_mask_returned );
|
|
+ }
|
|
}
|
|
|
|
if ( pixmap_path != NULL )
|
|
@@ -1543,3 +1549,46 @@ void XUTILDetermineFrameBufferVisual( Di
|
|
}
|
|
}
|
|
}
|
|
+
|
|
+static void
|
|
+change_state (Display *d, Screen * screen, Window xwindow, int add,
|
|
+ Atom state1, Atom state2)
|
|
+{
|
|
+ XEvent xev;
|
|
+
|
|
+ xev.xclient.type = ClientMessage;
|
|
+ xev.xclient.serial = 0;
|
|
+ xev.xclient.send_event = True;
|
|
+ xev.xclient.display = d;
|
|
+ xev.xclient.window = xwindow;
|
|
+ xev.xclient.message_type = XInternAtom (d, "_NET_WM_STATE", FALSE);
|
|
+ xev.xclient.format = 32;
|
|
+ xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
|
+ xev.xclient.data.l[1] = state1;
|
|
+ xev.xclient.data.l[2] = state2;
|
|
+
|
|
+ XSendEvent (d, RootWindowOfScreen (screen), False,
|
|
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
|
|
+}
|
|
+
|
|
+void XUTILSetAlwaysOnTop(TV_BOOL status)
|
|
+{
|
|
+ Display *d = TVDISPLAY;
|
|
+ Screen *screen = XtScreen ( TVTOPLEVEL );
|
|
+ Window win = XtWindow ( TVTOPLEVEL );
|
|
+ static Atom xa_ABOVE = 0;
|
|
+ static Atom xa_BELOW = 0;
|
|
+
|
|
+ if (!xa_ABOVE)
|
|
+ {
|
|
+ xa_ABOVE = XInternAtom (d, "_NET_WM_STATE_ABOVE", FALSE);
|
|
+ xa_BELOW = XInternAtom (d, "_NET_WM_STATE_BELOW", FALSE);
|
|
+ }
|
|
+
|
|
+ if (status) {
|
|
+ change_state (d, screen, win, FALSE, xa_ABOVE, xa_BELOW);
|
|
+ change_state (d, screen, win, TRUE, xa_ABOVE, None);
|
|
+ } else {
|
|
+ change_state (d, screen, win, FALSE, xa_ABOVE, xa_BELOW);
|
|
+ }
|
|
+}
|