summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2015-10-30 14:45:18 +0100
committerOndrej Holy <oholy@redhat.com>2015-11-04 16:55:13 +0100
commit6e080eb727d6a7600408d3be9604ebf9d95b6cf6 (patch)
tree8885a1bc66c4e7033f9805de107d27c584030442
parent3bcb0b3505298eba299610a505ea28d6bca36e81 (diff)
seamless-mode: Add hack for round cornersseamless-mode
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.c43
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);
}