summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorRob Adams <robadams@ucla.edu>2003-06-26 03:09:38 +0000
committerRob Adams <readams@src.gnome.org>2003-06-26 03:09:38 +0000
commit971f3f120763003f060bcbf88f872632a0edb1cd (patch)
treeafe069c2ff9f043dcaf4fbae063c4a9861d078eb /src/tools
parent3a39036dcbd983b56be1b23c3a686987571bfe39 (diff)
downloadmetacity-971f3f120763003f060bcbf88f872632a0edb1cd.tar.gz
metacity-971f3f120763003f060bcbf88f872632a0edb1cd.tar.bz2
Update constraints code to support the new _NET_WM_STRUT_PARTIAL EWMH
2003-06-10 Rob Adams <robadams@ucla.edu> Update constraints code to support the new _NET_WM_STRUT_PARTIAL EWMH draft specification. See #86682. Also, fix a bug involving work area invalidation on metacity startup. Fix for #108497. Finally, some minor fixes for full screen windows. * src/window.h: Add new MetaStruts structure to store strut rects for a window. Remove has_struts and do_not_cover flag, and support new MetaStruts instead of the four ints. * src/window.c (meta_window_new): change initialization to work with new struts. Also, move meta_window_update_struts call to after the workspaces are initialized to fix #108497. Remove do_not_cover and related code. (process_property_notify): add strut_partial (update_struts): change function name to meta_window_update_struts and expose in external MetaWindow API. Support partial width struts and the new strut rects. * src/workspace.h: add new GSLists containing pointers to all relevant struts for this workspace. * src/workspace.c (meta_workspace_new): initialize the list of strut rects for this workspace. (meta_workspace_free): free the strut rect lists (ensure_work_areas_validated): support new struts and new strut rect lists. Unleash the per-xinerama work areas. * src/constraints.c (get_outermost_onscreen_positions): Use the current window position along with the new per-workspace strut rects to compute the constraints that apply to a particular window. (constraint_hint_applies_func): don't do hints constraints on fullscreen windows (update_position_limits): for maximized windows use the work areas to set the position limits; for other windows rely on the struts constraints to be computed later in get_outermost_onscreen_positions (meta_window_constrain): don't apply aspect ratio hints to full screen windows * src/display.c (meta_display_open): add _NET_WM_STRUT_PARTIAL atom (meta_rectangle_equal): new helper function for MetaRectangles (event_queue_callback): #ifndef out if USE_GDK_DISPLAY not set to avoid compiler warning * src/display.h: add atom_net_wm_strut_partial, and add meta_rectangle_equal. * src/screen.c (meta_screen_rect_intersects_xinerama): change _window_intersects_ to _rect_intersects_ which is more useful now. (meta_screen_resize_func): update struts on windows with struts since struts are relative to the screen size, and this function is called when the screen size updates. * src/screen.h (meta_screen_rect_intersects_xinerama): change _window_intersects_ to _rect_intersects_ which is more useful now. * src/window-props.c (meta_display_init_window_prop_hooks): add hook for strut_partial * src/tools/metacity-window-demo.c: Support partial-width struts on the dock window tests for metacity testing purposes.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/metacity-window-demo.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/tools/metacity-window-demo.c b/src/tools/metacity-window-demo.c
index 215ab6d..718f1f0 100644
--- a/src/tools/metacity-window-demo.c
+++ b/src/tools/metacity-window-demo.c
@@ -33,19 +33,27 @@ set_gdk_window_struts (GdkWindow *window,
int top,
int bottom)
{
- long vals[4];
+ long vals[12];
vals[0] = left;
vals[1] = right;
vals[2] = top;
vals[3] = bottom;
-
+ vals[4] = 000;
+ vals[5] = 400;
+ vals[6] = 200;
+ vals[7] = 600;
+ vals[8] = 76;
+ vals[9] = 676;
+ vals[10] = 200;
+ vals[11] = 800;
+
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window),
- "_NET_WM_STRUT", False),
+ "_NET_WM_STRUT_PARTIAL", False),
XA_CARDINAL, 32, PropModeReplace,
- (guchar *)vals, 4);
+ (guchar *)vals, 12);
}
static void
@@ -441,6 +449,7 @@ border_only_cb (gpointer callback_data,
gtk_widget_show_all (window);
}
+#if 0
static void
changing_icon_cb (gpointer callback_data,
guint callback_action,
@@ -462,6 +471,7 @@ changing_icon_cb (gpointer callback_data,
gtk_widget_show_all (window);
}
+#endif
static gboolean
focus_in_event_cb (GtkWidget *window,
@@ -473,6 +483,8 @@ focus_in_event_cb (GtkWidget *window,
widget = GTK_WIDGET (data);
gtk_label_set_text (GTK_LABEL (widget), "Has focus");
+
+ return TRUE;
}
@@ -486,6 +498,8 @@ focus_out_event_cb (GtkWidget *window,
widget = GTK_WIDGET (data);
gtk_label_set_text (GTK_LABEL (widget), "Not focused");
+
+ return TRUE;
}
static GtkWidget*
@@ -583,26 +597,26 @@ make_dock (int type)
switch (type)
{
case DOCK_LEFT:
- gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
- gtk_window_move (GTK_WINDOW (window), 0, 0);
+ gtk_widget_set_size_request (window, DOCK_SIZE, 400);
+ gtk_window_move (GTK_WINDOW (window), 0, 000);
set_gtk_window_struts (window, DOCK_SIZE, 0, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "LeftDock");
break;
case DOCK_RIGHT:
- gtk_widget_set_size_request (window, DOCK_SIZE, gdk_screen_height ());
- gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 0);
+ gtk_widget_set_size_request (window, DOCK_SIZE, 400);
+ gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 200);
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "RightDock");
break;
case DOCK_TOP:
- gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
- gtk_window_move (GTK_WINDOW (window), 0, 0);
+ gtk_widget_set_size_request (window, 600, DOCK_SIZE);
+ gtk_window_move (GTK_WINDOW (window), 76, 0);
set_gtk_window_struts (window, 0, 0, DOCK_SIZE, 0);
gtk_window_set_title (GTK_WINDOW (window), "TopDock");
break;
case DOCK_BOTTOM:
- gtk_widget_set_size_request (window, gdk_screen_width (), DOCK_SIZE);
- gtk_window_move (GTK_WINDOW (window), 0, gdk_screen_height () - DOCK_SIZE);
+ gtk_widget_set_size_request (window, 600, DOCK_SIZE);
+ gtk_window_move (GTK_WINDOW (window), 200, gdk_screen_height () - DOCK_SIZE);
set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
gtk_window_set_title (GTK_WINDOW (window), "BottomDock");
break;