[gtk+/wip/otte/gtk4: 15/118] testgtk: Remove feature unsupported in Wayland
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 15/118] testgtk: Remove feature unsupported in Wayland
- Date: Fri, 7 Oct 2016 00:00:57 +0000 (UTC)
commit 6e9f24a03a7094cc1a8c36ee20643c16a4daf458
Author: Benjamin Otte <otte redhat com>
Date: Tue Sep 6 01:23:41 2016 +0200
testgtk: Remove feature unsupported in Wayland
Wayland doesn't allow positioning windows randomly, so don't try.
tests/testgtk.c | 214 -------------------------------------------------------
1 files changed, 0 insertions(+), 214 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index d158798..7a4b7ca 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -7597,213 +7597,6 @@ pos_selected (GtkWidget *widget,
gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) + GTK_WIN_POS_NONE);
}
-static void
-move_gravity_window_to_current_position (GtkWidget *widget,
- gpointer data)
-{
- gint x, y;
- GtkWindow *window;
-
- window = GTK_WINDOW (data);
-
- gtk_window_get_position (window, &x, &y);
-
- gtk_window_move (window, x, y);
-}
-
-static void
-get_screen_corner (GtkWindow *window,
- gint *x,
- gint *y)
-{
- int w, h;
- GdkScreen * screen = gtk_window_get_screen (window);
-
- gtk_window_get_size (GTK_WINDOW (window), &w, &h);
-
- switch (gtk_window_get_gravity (window))
- {
- case GDK_GRAVITY_SOUTH_EAST:
- *x = gdk_screen_get_width (screen) - w;
- *y = gdk_screen_get_height (screen) - h;
- break;
-
- case GDK_GRAVITY_NORTH_EAST:
- *x = gdk_screen_get_width (screen) - w;
- *y = 0;
- break;
-
- case GDK_GRAVITY_SOUTH_WEST:
- *x = 0;
- *y = gdk_screen_get_height (screen) - h;
- break;
-
- case GDK_GRAVITY_NORTH_WEST:
- *x = 0;
- *y = 0;
- break;
-
- case GDK_GRAVITY_SOUTH:
- *x = (gdk_screen_get_width (screen) - w) / 2;
- *y = gdk_screen_get_height (screen) - h;
- break;
-
- case GDK_GRAVITY_NORTH:
- *x = (gdk_screen_get_width (screen) - w) / 2;
- *y = 0;
- break;
-
- case GDK_GRAVITY_WEST:
- *x = 0;
- *y = (gdk_screen_get_height (screen) - h) / 2;
- break;
-
- case GDK_GRAVITY_EAST:
- *x = gdk_screen_get_width (screen) - w;
- *y = (gdk_screen_get_height (screen) - h) / 2;
- break;
-
- case GDK_GRAVITY_CENTER:
- *x = (gdk_screen_get_width (screen) - w) / 2;
- *y = (gdk_screen_get_height (screen) - h) / 2;
- break;
-
- case GDK_GRAVITY_STATIC:
- /* pick some random numbers */
- *x = 350;
- *y = 350;
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-static void
-move_gravity_window_to_starting_position (GtkWidget *widget,
- gpointer data)
-{
- gint x, y;
- GtkWindow *window;
-
- window = GTK_WINDOW (data);
-
- get_screen_corner (window,
- &x, &y);
-
- gtk_window_move (window, x, y);
-}
-
-static GtkWidget*
-make_gravity_window (GtkWidget *destroy_with,
- GdkGravity gravity,
- const gchar *title)
-{
- GtkWidget *window;
- GtkWidget *button;
- GtkWidget *vbox;
- int x, y;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (destroy_with));
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show (vbox);
-
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_window_set_title (GTK_WINDOW (window), title);
- gtk_window_set_gravity (GTK_WINDOW (window), gravity);
-
- g_signal_connect_object (destroy_with,
- "destroy",
- G_CALLBACK (gtk_widget_destroy),
- window,
- G_CONNECT_SWAPPED);
-
-
- button = gtk_button_new_with_mnemonic ("_Move to current position");
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (move_gravity_window_to_current_position),
- window);
-
- gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_mnemonic ("Move to _starting position");
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (move_gravity_window_to_starting_position),
- window);
-
- gtk_container_add (GTK_CONTAINER (vbox), button);
- gtk_widget_show (button);
-
- gtk_window_set_default_size (GTK_WINDOW (window),
- 200, 200);
-
- get_screen_corner (GTK_WINDOW (window), &x, &y);
-
- gtk_window_move (GTK_WINDOW (window),
- x, y);
-
- return window;
-}
-
-static void
-do_gravity_test (GtkWidget *widget,
- gpointer data)
-{
- GtkWidget *destroy_with = data;
- GtkWidget *window;
-
- /* We put a window at each gravity point on the screen. */
- window = make_gravity_window (destroy_with, GDK_GRAVITY_NORTH_WEST,
- "NorthWest");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_SOUTH_EAST,
- "SouthEast");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_NORTH_EAST,
- "NorthEast");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_SOUTH_WEST,
- "SouthWest");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_SOUTH,
- "South");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_NORTH,
- "North");
- gtk_widget_show (window);
-
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_WEST,
- "West");
- gtk_widget_show (window);
-
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_EAST,
- "East");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_CENTER,
- "Center");
- gtk_widget_show (window);
-
- window = make_gravity_window (destroy_with, GDK_GRAVITY_STATIC,
- "Static");
- gtk_widget_show (window);
-}
-
static GtkWidget*
window_controls (GtkWidget *window)
{
@@ -7859,13 +7652,6 @@ window_controls (GtkWidget *window)
g_object_set_data (G_OBJECT (control_window), "spin2", spin);
- button = gtk_button_new_with_label ("Show gravity test windows");
- g_signal_connect_swapped (button,
- "clicked",
- G_CALLBACK (do_gravity_test),
- control_window);
- gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
button = gtk_button_new_with_label ("Reshow with initial size");
g_signal_connect_object (button,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]