summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorRob Adams <robadams@ucla.edu>2003-07-28 02:09:20 +0000
committerRob Adams <readams@src.gnome.org>2003-07-28 02:09:20 +0000
commit57272355723dabb869e19dc81b4c0dba6ad94a6d (patch)
tree62da2a99b3d88686daebfe611038335ce33ff24c /src/tools
parent74fa2a7ab2aa1f1cb750805993ca38e9f7e3eaff (diff)
downloadmetacity-57272355723dabb869e19dc81b4c0dba6ad94a6d.tar.gz
Update window shaking loose so that the window is moved to the pointer and
2003-07-27 Rob Adams <robadams@ucla.edu> * src/window.c (update_move): Update window shaking loose so that the window is moved to the pointer and certain drag state is properly restored once windows "reattach". Fix for #115000 based on the patch by Jurg Billeter. * src/screen.c (meta_screen_resize): Invalidate work areas after an xrandr screen size update. Fix for #117230. * src/stack.c (window_is_fullscreen_size): Check the bottom corner of the window in addition to the top corner. Fix for #118194. * src/constraints.c (meta_window_constrain): Support aspect ratio hints in the new constraints code. Fix for #113798. * src/tools/metacity-window-demo.c (toggle_aspect_ratio): toggle the aspect ratio hints to force a 16:9 aspect ratio. (do_appwindow): add a button to toggle aspect ratio.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/metacity-window-demo.c100
1 files changed, 70 insertions, 30 deletions
diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c
index 718f1f0a..a3dc157b 100644
--- a/src/tools/metacity-window-demo.c
+++ b/src/tools/metacity-window-demo.c
@@ -26,6 +26,8 @@
static GtkWidget* do_appwindow (void);
+gboolean aspect_on;
+
static void
set_gdk_window_struts (GdkWindow *window,
int left,
@@ -702,6 +704,34 @@ sleep_cb (GtkWidget *button,
sleep (1000);
}
+toggle_aspect_ratio (GtkWidget *button,
+ gpointer data)
+{
+ GtkWidget *window;
+ GdkGeometry geom;
+
+ if (aspect_on)
+ {
+ geom.min_aspect = 0;
+ geom.max_aspect = 65535;
+ }
+ else
+ {
+ geom.min_aspect = 1.777778;
+ geom.max_aspect = 1.777778;
+ }
+
+ aspect_on = !aspect_on;
+
+ window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+ if (window)
+ gtk_window_set_geometry_hints (GTK_WINDOW (window),
+ GTK_WIDGET (data),
+ &geom,
+ GDK_HINT_ASPECT);
+
+}
+
static void
toggle_decorated_cb (GtkWidget *button,
gpointer data)
@@ -799,7 +829,9 @@ do_appwindow (void)
*/
++window_count;
-
+
+ aspect_on = FALSE;
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
@@ -838,6 +870,35 @@ do_appwindow (void)
GTK_EXPAND | GTK_FILL, 0,
0, 0);
+ /* Create document
+ */
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+ GTK_SHADOW_IN);
+
+ gtk_table_attach (GTK_TABLE (table),
+ sw,
+ /* X direction */ /* Y direction */
+ 0, 1, 2, 3,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 0, 0);
+
+ gtk_window_set_default_size (GTK_WINDOW (window),
+ 200, 200);
+
+ contents = gtk_text_view_new ();
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
+ PANGO_WRAP_WORD);
+
+ gtk_container_add (GTK_CONTAINER (sw),
+ contents);
+
/* Create the toolbar
*/
toolbar = gtk_toolbar_new ();
@@ -867,6 +928,14 @@ do_appwindow (void)
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+ GTK_STOCK_OPEN,
+ "This is a demo button that locks the aspect ratio using a hint",
+ NULL,
+ G_CALLBACK (toggle_aspect_ratio),
+ contents, /* user data for callback */
+ -1); /* -1 means "append" */
+
+ gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
NULL,
@@ -885,35 +954,6 @@ do_appwindow (void)
GTK_EXPAND | GTK_FILL, 0,
0, 0);
- /* Create document
- */
-
- sw = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_IN);
-
- gtk_table_attach (GTK_TABLE (table),
- sw,
- /* X direction */ /* Y direction */
- 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- gtk_window_set_default_size (GTK_WINDOW (window),
- 200, 200);
-
- contents = gtk_text_view_new ();
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
- PANGO_WRAP_WORD);
-
- gtk_container_add (GTK_CONTAINER (sw),
- contents);
-
/* Create statusbar */
statusbar = gtk_statusbar_new ();