diff options
author | Ondrej Holy <oholy@redhat.com> | 2015-10-30 14:45:18 +0100 |
---|---|---|
committer | Lukas Venhoda <lvenhoda@redhat.com> | 2016-07-28 19:14:18 +0200 |
commit | 8377d12bd24edc8b025ab6777012b5bb1a4f9e61 (patch) | |
tree | e6f42f2e6be07d40834af1221731a6e510b8273b | |
parent | 014a379c94712113c76934604368b67b225fb7fd (diff) |
seamless-mode: Add hack for round cornersseamless-mode-gnome
X11 shape extension can't be used to detect window shapes, because
wrong shapes are returned if client-side decorations are used. Gnome
uses theme with round corners by default. The windows looks ugly on
client, because there is black instead of transparent round corners.
This hack simply split the one window rectangle into several rectangles
of different sizes to fake round corners.
It is just stupid hack, which have to be done more sophisticated later.
It is not intended to be really pushed to upstream.
It won't work if we use multiple client windows. I expect we will
revert the patch soon...
-rw-r--r-- | src/vdagent-x11-seamless-mode.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/vdagent-x11-seamless-mode.c b/src/vdagent-x11-seamless-mode.c index 1d5abaf..adc958c 100644 --- a/src/vdagent-x11-seamless-mode.c +++ b/src/vdagent-x11-seamless-mode.c @@ -132,6 +132,20 @@ get_window_type(Display *display, Window window) return None; } +/* Determine whether the window is popup. */ +static gboolean +is_popup(Display *display, Window window) +{ + Atom type, atom; + + type = get_window_type(display, window); + if (type == None) + return FALSE; + + atom = XInternAtom(display, "_NET_WM_WINDOW_TYPE_POPUP_MENU", 0); + return (type == atom); +} + static void get_geometry(Display *display, Window window, gint *x, gint *y, guint *w, guint *h) @@ -238,6 +252,35 @@ get_window_list(struct vdagent_x11 *x11, Window window) continue; } + /* Stupid hack for round corners */ + // TODO: Use only for GNOME? + if (!is_popup(x11->display, list[i])) { + SpiceWindow *window; + + window = g_new0(SpiceWindow, 1); + window->x = spice_window->x + 4; + window->y = spice_window->y; + window->w = spice_window->w - 8; + window->h = 1; + window_list = g_list_append(window_list, window); + + window = g_new0(SpiceWindow, 1); + window->x = spice_window->x + 2; + window->y = spice_window->y + 1; + window->w = spice_window->w - 4; + window->h = 1; + window_list = g_list_append(window_list, window); + + window = g_new0(SpiceWindow, 1); + window->x = spice_window->x + 1; + window->y = spice_window->y + 2; + window->w = spice_window->w - 2; + window->h = 2; + window_list = g_list_append(window_list, window); + + spice_window->y += 4; + spice_window->h -= 4; + } window_list = g_list_append(window_list, spice_window); } |