From 9d89b0be7d5d997790cc89f5bb68527c8ff23932 Mon Sep 17 00:00:00 2001 From: Søren Sandmann Pedersen Date: Thu, 8 Dec 2011 21:15:04 -0500 Subject: Disable decorations --- main.c | 3 +++ window.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 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 #include #include +#include #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 -- cgit v1.2.3