diff options
author | Xi Yan | 2018-09-27 18:16:35 +0000 |
---|---|---|
committer | Eric Williams | 2018-09-28 14:52:37 +0000 |
commit | 9d272d0ba1a3981de491fda41ab96cab85f7fea0 (patch) | |
tree | ccffc472692181005f383457f69ab680d16cee9a /tests/org.eclipse.swt.tests.gtk | |
parent | d04a0ca6c97ae9e6aa4ecca2e06276a6ed004741 (diff) | |
download | eclipse.platform.swt-9d272d0ba1a3981de491fda41ab96cab85f7fea0.tar.gz eclipse.platform.swt-9d272d0ba1a3981de491fda41ab96cab85f7fea0.tar.xz eclipse.platform.swt-9d272d0ba1a3981de491fda41ab96cab85f7fea0.zip |
Bug 535083 - [Wayland] setRegion() and transparent shells don't work.
Platform Part-Drag causes eclipse black-out.
1) Replaced gdk_window_shape_combine_region with
gtk_widget_shape_combine_region wrapper in Control#setRegion.
2) There is a bug in GTK on Wayland where pixels in window outside
shape_region is black instead of transparent when the GtkWidget has
opacity of 1.0. This causes the problem where part-drag rectangles
introduces a black overlay shell covering Eclipse itself. This patch
uses a hack where the opacity of the widget is set to 0.99 whenever we
want to set a custom region.
3) Make the GTK_WINDOW_POPUP overlay in Tracker transient to the parent
if possible to avoid window not mapped warning on Wayland.
Tested on Wayland with Snippet134, Snippet 285, and child Eclipse.
Change-Id: I5f2a1bdd3a7acee87b09ab23f8951da0dbbd5c53
Signed-off-by: Xi Yan <xixiyan@redhat.com>
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk')
-rw-r--r-- | tests/org.eclipse.swt.tests.gtk/ManualNativeCTests/BugSnippets/Bug_535083_Set_Region_Black_Out.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualNativeCTests/BugSnippets/Bug_535083_Set_Region_Black_Out.c b/tests/org.eclipse.swt.tests.gtk/ManualNativeCTests/BugSnippets/Bug_535083_Set_Region_Black_Out.c new file mode 100644 index 0000000000..cff800cdff --- /dev/null +++ b/tests/org.eclipse.swt.tests.gtk/ManualNativeCTests/BugSnippets/Bug_535083_Set_Region_Black_Out.c @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. All rights reserved. + * The contents of this file are made available under the terms + * of the GNU Lesser General Public License (LGPL) Version 2.1 that + * accompanies this distribution (lgpl-v21.txt). The LGPL is also + * available at http://www.gnu.org/licenses/lgpl.html. If the version + * of the LGPL at http://www.gnu.org is different to the version of + * the LGPL accompanying this distribution and there is any conflict + * between the two license versions, the terms of the LGPL accompanying + * this distribution shall govern. + * + * Contributors: + * Red Hat - initial API and implementation + *******************************************************************************/ + +#include <gtk/gtk.h> + +static gboolean delete_event(GtkWidget*, GdkEvent*, gpointer); + +static void move_cb(GtkWidget *button, gpointer data) { + GtkWidget *window = (GtkWidget *) data; + cairo_region_t *region; + GdkRectangle rect; + rect.x = 0; + rect.y = 0; + rect.width = 500; + rect.height = 300; + // gtk_window_move((GtkWindow *) window, 300, 300); + region = cairo_region_create_rectangle(&rect); + gtk_widget_shape_combine_region(window, region); + gtk_window_resize(GTK_WINDOW(window), 1000, 599); + + // NO BLACK AREA IF SET OPACITY TO < 1 + // gtk_widget_set_opacity(window, 0.99); +} + +int main(int argc, char *argv[]) { + GtkWidget *window; + GtkWidget *main_vbox; + GtkWidget *move_button; + + gtk_init(&argc, &argv); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect(window, "delete_event", G_CALLBACK(delete_event), NULL); + gtk_window_resize(GTK_WINDOW(window), 1000, 600); + + main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add(GTK_CONTAINER(window), main_vbox); + + move_button = gtk_button_new_with_label("Set Region"); + gtk_box_pack_end(GTK_BOX(main_vbox), move_button, FALSE, TRUE, 0); + g_signal_connect(move_button, "clicked", G_CALLBACK(move_cb), window); + + gtk_widget_show_all(window); + gtk_main(); + return 0; +} + +static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) { + gtk_main_quit(); + return FALSE; +} + + |