pkgsrc/multimedia/fxtv/patches/patch-bf
2004-01-26 11:36:35 +00:00

70 lines
2 KiB
Text

$NetBSD: patch-bf,v 1.1.1.1 2004/01/26 11:36:40 jmmv Exp $
--- xutil.c.orig 1999-11-05 01:38:54.000000000 +0100
+++ 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];
@@ -1543,3 +1548,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);
+ }
+}