summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-12-08 21:15:04 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-12-08 21:18:35 -0500
commit9d89b0be7d5d997790cc89f5bb68527c8ff23932 (patch)
tree54d4cae25f4d0dbf2990d1b825c398af63e76139
parent643e29a4e07ab183ff3708cd5a6f4362dd014c55 (diff)
Disable decorations
-rw-r--r--main.c3
-rw-r--r--window.c60
2 files changed, 60 insertions, 3 deletions
diff --git a/main.c b/main.c
index 973499f..98cb9b1 100644
--- a/main.c
+++ b/main.c
@@ -83,6 +83,9 @@ main ()
ws_window_copy_from_image (window, image, 0, 0, 0, h - 20, w, 20);
pixman_image_unref (image);
+ ws_window_resize (window, 700, 700);
+ ws_window_move (window, 600, 200);
+
ws_window_finish (&window, 1);
}
diff --git a/window.c b/window.c
index 11b7135..03195e9 100644
--- a/window.c
+++ b/window.c
@@ -2,6 +2,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <assert.h>
+#include <string.h>
#include "window.h"
#include "list.h"
@@ -341,6 +342,8 @@ process_configure_notify (ws_t *ws, XEvent *event)
Window child_window;
Display *dpy = window->ws->display;
+ printf ("new untranslated: %d %d\n",
+ event->xconfigure.x, event->xconfigure.y);
XTranslateCoordinates (
dpy, window->xid, RootWindow (dpy, 0), 0, 0, &new_x, &new_y,
&child_window);
@@ -354,6 +357,8 @@ process_configure_notify (ws_t *ws, XEvent *event)
new_width = event->xconfigure.width;
new_height = event->xconfigure.height;
+ printf ("new: %d %d %d %d\n", new_x, new_y, new_width, new_height);
+
/* If we are configure to a new size, then notify the user */
config_type = 0;
@@ -577,6 +582,34 @@ ws_process (ws_t *ws)
}
}
+typedef struct
+{
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+} motif_hints_t;
+
+#define MWM_HINTS_DECORATIONS (1 << 1)
+
+static void
+disable_decorations (window_t *window)
+{
+ Display *dpy = window->ws->display;
+ Atom atom = XInternAtom (dpy, "_MOTIF_WM_HINTS", FALSE);
+ motif_hints_t hints;
+
+ memset (&hints, 0, sizeof (hints));
+ hints.flags = MWM_HINTS_DECORATIONS;
+ hints.decorations = 0;
+
+ XChangeProperty (dpy, window->xid,
+ atom, atom, 32, PropModeReplace,
+ (unsigned char *)&hints,
+ sizeof (motif_hints_t) / sizeof (long));
+}
+
/* Window */
window_t *
ws_create_window (ws_t *ws,
@@ -619,7 +652,9 @@ ws_create_window (ws_t *ws,
list_init (&window->event_queue);
window->motion_notify_time = 0;
-
+
+ disable_decorations (window);
+
return window;
}
@@ -659,10 +694,29 @@ ws_window_move_resize (window_t *window,
int width,
int height)
{
+ int need = 0;
+
+ if (x != window->x || y != window->y)
+ need |= 1;
+ if (width != get_width (window) || height != get_height (window))
+ need |= 2;
+
update_local_geometry (window, x, y, width, height);
- XMoveResizeWindow (
- window->ws->display, window->xid, x, y, width, height);
+ switch (need)
+ {
+ case 0:
+ break;
+ case 1:
+ XMoveWindow (window->ws->display, window->xid, x, y);
+ break;
+ case 2:
+ XResizeWindow (window->ws->display, window->xid, width, height);
+ break;
+ case 3:
+ XMoveResizeWindow (window->ws->display, window->xid, x, y, width, height);
+ break;
+ }
}
void