Unbreak tab popup a bit.

2001-08-28  Havoc Pennington  <hp@pobox.com>

        Unbreak tab popup a bit.

	* src/stack.c (meta_stack_get_tab_list): add workspace argument
	(meta_stack_get_tab_next): add workspace argument

	* src/window.c: implement recording of the last user-initiated
	window position, so we can magically handle moving panels around
	really nicely.

	* src/wm-tester/main.c (set_up_icon_windows): fix to use new GTK
	API
This commit is contained in:
Havoc Pennington 2001-08-29 03:37:03 +00:00 committed by Havoc Pennington
parent 4d2f018ddb
commit db0a7e2978
10 changed files with 211 additions and 85 deletions

View File

@ -1,3 +1,17 @@
2001-08-28 Havoc Pennington <hp@pobox.com>
Unbreak tab popup a bit.
* src/stack.c (meta_stack_get_tab_list): add workspace argument
(meta_stack_get_tab_next): add workspace argument
* src/window.c: implement recording of the last user-initiated
window position, so we can magically handle moving panels around
really nicely.
* src/wm-tester/main.c (set_up_icon_windows): fix to use new GTK
API
2001-08-24 Havoc Pennington <hp@pobox.com> 2001-08-24 Havoc Pennington <hp@pobox.com>
* src/window.c (constrain_position): force fullscreen windows to * src/window.c (constrain_position): force fullscreen windows to

View File

@ -91,8 +91,7 @@ meta_core_user_move (Display *xdisplay,
if (window == NULL || window->frame == NULL) if (window == NULL || window->frame == NULL)
meta_bug ("No such frame window 0x%lx!\n", frame_xwindow); meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
window->user_has_moved = TRUE; meta_window_move (window, TRUE, x, y);
meta_window_move (window, x, y);
} }
void void
@ -111,8 +110,7 @@ meta_core_user_resize (Display *xdisplay,
if (window == NULL || window->frame == NULL) if (window == NULL || window->frame == NULL)
meta_bug ("No such frame window 0x%lx!\n", frame_xwindow); meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
window->user_has_resized = TRUE; meta_window_resize_with_gravity (window, TRUE, width, height, gravity);
meta_window_resize_with_gravity (window, width, height, gravity);
} }
void void

View File

@ -581,6 +581,7 @@ process_keyboard_move_grab (MetaDisplay *display,
case XK_Escape: case XK_Escape:
/* End move and restore to original position */ /* End move and restore to original position */
meta_window_move_resize (display->grab_window, meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x, display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y, display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width, display->grab_initial_window_pos.width,
@ -592,7 +593,7 @@ process_keyboard_move_grab (MetaDisplay *display,
} }
if (handled) if (handled)
meta_window_move (window, x, y); meta_window_move (window, TRUE, x, y);
return handled; return handled;
} }
@ -832,6 +833,7 @@ handle_tab_forward (MetaDisplay *display,
if (display->focus_window != NULL) if (display->focus_window != NULL)
{ {
window = meta_stack_get_tab_next (display->focus_window->screen->stack, window = meta_stack_get_tab_next (display->focus_window->screen->stack,
display->focus_window->screen->active_workspace,
display->focus_window, display->focus_window,
FALSE); FALSE);
} }
@ -849,7 +851,8 @@ handle_tab_forward (MetaDisplay *display,
if (screen) if (screen)
{ {
window = meta_stack_get_tab_next (screen->stack, window = meta_stack_get_tab_next (screen->stack,
event_window, screen->active_workspace,
NULL,
FALSE); FALSE);
} }
} }
@ -890,6 +893,7 @@ handle_tab_backward (MetaDisplay *display,
if (display->focus_window != NULL) if (display->focus_window != NULL)
{ {
window = meta_stack_get_tab_next (display->focus_window->screen->stack, window = meta_stack_get_tab_next (display->focus_window->screen->stack,
display->focus_window->screen->active_workspace,
display->focus_window, display->focus_window,
TRUE); TRUE);
} }
@ -907,7 +911,8 @@ handle_tab_backward (MetaDisplay *display,
if (screen) if (screen)
{ {
window = meta_stack_get_tab_next (screen->stack, window = meta_stack_get_tab_next (screen->stack,
event_window, screen->active_workspace,
NULL,
TRUE); TRUE);
} }
} }
@ -940,29 +945,36 @@ handle_focus_previous (MetaDisplay *display,
gpointer data) gpointer data)
{ {
MetaWindow *window; MetaWindow *window;
MetaScreen *screen;
meta_verbose ("Focus previous window\n"); meta_verbose ("Focus previous window\n");
screen = meta_display_screen_for_root (display,
event->xkey.root);
if (screen == NULL)
return;
window = display->prev_focus_window; window = display->prev_focus_window;
if (window &&
!meta_workspace_contains_window (screen->active_workspace,
window))
window = NULL;
if (window == NULL) if (window == NULL)
{ {
/* Pick first window in tab order */ /* Pick first window in tab order */
MetaScreen *screen; window = meta_stack_get_tab_next (screen->stack,
screen->active_workspace,
screen = meta_display_screen_for_root (display, NULL,
event->xkey.root); TRUE);
/* We get the screen because event_window may be NULL,
* in which case we can't use event_window->screen
*/
if (screen)
{
window = meta_stack_get_tab_next (screen->stack,
event_window,
TRUE);
}
} }
if (window &&
!meta_workspace_contains_window (screen->active_workspace,
window))
window = NULL;
if (window) if (window)
{ {

View File

@ -464,7 +464,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen)
if (screen->tab_popup) if (screen->tab_popup)
return; return;
tab_list = meta_stack_get_tab_list (screen->stack); tab_list = meta_stack_get_tab_list (screen->stack,
screen->active_workspace);
len = g_slist_length (tab_list); len = g_slist_length (tab_list);
entries = g_new (MetaTabEntry, len + 1); entries = g_new (MetaTabEntry, len + 1);

View File

@ -862,12 +862,23 @@ find_tab_backward (MetaStack *stack,
/* This ignores the dock/desktop layers */ /* This ignores the dock/desktop layers */
MetaWindow* MetaWindow*
meta_stack_get_tab_next (MetaStack *stack, meta_stack_get_tab_next (MetaStack *stack,
MetaWindow *window, MetaWorkspace *workspace,
gboolean backward) MetaWindow *window,
gboolean backward)
{ {
int i; int i;
if (workspace && window)
{
/* This is a paranoia check, because races can happen where
* you get a key shortcut or something on a window just as you
* are moving workspaces to one the window isn't on
*/
if (!meta_workspace_contains_window (workspace, window))
return NULL;
}
if (stack->windows->len == 0) if (stack->windows->len == 0)
return NULL; return NULL;
@ -881,11 +892,7 @@ meta_stack_get_tab_next (MetaStack *stack,
w = g_array_index (stack->windows, Window, i); w = g_array_index (stack->windows, Window, i);
if (w == window->xwindow) if (w == window->xwindow)
{ {
MetaWorkspace *workspace;
workspace = window->screen->active_workspace;
if (backward) if (backward)
return find_tab_backward (stack, workspace, i); return find_tab_backward (stack, workspace, i);
else else
@ -900,14 +907,15 @@ meta_stack_get_tab_next (MetaStack *stack,
* window and we need to wrap around * window and we need to wrap around
*/ */
if (backward) if (backward)
return find_tab_backward (stack, NULL, return find_tab_backward (stack, workspace,
stack->windows->len); stack->windows->len);
else else
return find_tab_forward (stack, NULL, -1); return find_tab_forward (stack, workspace, -1);
} }
GSList* GSList*
meta_stack_get_tab_list (MetaStack *stack) meta_stack_get_tab_list (MetaStack *stack,
MetaWorkspace *workspace)
{ {
GSList *list; GSList *list;
int i; int i;
@ -918,15 +926,9 @@ meta_stack_get_tab_list (MetaStack *stack)
while (i < stack->windows->len) while (i < stack->windows->len)
{ {
MetaWindow *window; MetaWindow *window;
MetaWorkspace *workspace;
window = meta_display_lookup_x_window (stack->screen->display, window = meta_display_lookup_x_window (stack->screen->display,
GET_XWINDOW (stack, i)); GET_XWINDOW (stack, i));
if (window)
workspace = window->screen->active_workspace;
else
workspace = NULL;
if (window && IN_TAB_CHAIN (window) && if (window && IN_TAB_CHAIN (window) &&
(workspace == NULL || (workspace == NULL ||

View File

@ -93,10 +93,13 @@ MetaWindow* meta_stack_get_above (MetaStack *stack,
MetaWindow* meta_stack_get_below (MetaStack *stack, MetaWindow* meta_stack_get_below (MetaStack *stack,
MetaWindow *window); MetaWindow *window);
MetaWindow* meta_stack_get_tab_next (MetaStack *stack, MetaWindow* meta_stack_get_tab_next (MetaStack *stack,
MetaWindow *window, MetaWorkspace *workspace,
gboolean backward); MetaWindow *window,
GSList* meta_stack_get_tab_list (MetaStack *stack); gboolean backward);
GSList* meta_stack_get_tab_list (MetaStack *stack,
MetaWorkspace *workspace);
/* -1 if a < b, etc. */ /* -1 if a < b, etc. */
int meta_stack_windows_cmp (MetaStack *stack, int meta_stack_windows_cmp (MetaStack *stack,
MetaWindow *window_a, MetaWindow *window_a,

View File

@ -61,6 +61,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
GtkWidget *table; GtkWidget *table;
GList *tmp; GList *tmp;
GtkWidget *frame; GtkWidget *frame;
int max_label_width;
popup = g_new (MetaTabPopup, 1); popup = g_new (MetaTabPopup, 1);
popup->window = gtk_window_new (GTK_WINDOW_POPUP); popup->window = gtk_window_new (GTK_WINDOW_POPUP);
@ -118,6 +119,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
3, 3); 3, 3);
max_label_width = 0;
top = 0; top = 0;
bottom = 1; bottom = 1;
tmp = popup->entries; tmp = popup->entries;
@ -130,6 +132,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
while (tmp && left < width) while (tmp && left < width)
{ {
GtkWidget *image; GtkWidget *image;
GtkRequisition req;
TabEntry *te; TabEntry *te;
@ -148,6 +151,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
left, right, top, bottom, left, right, top, bottom,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
0, 0); 0, 0);
/* Efficiency rules! */
gtk_label_set_text (GTK_LABEL (popup->label),
te->title);
gtk_widget_size_request (popup->label, &req);
max_label_width = MAX (max_label_width, req.width);
tmp = tmp->next; tmp = tmp->next;
@ -158,7 +167,14 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
++top; ++top;
++bottom; ++bottom;
} }
/* remove all the temporary text */
gtk_label_set_text (GTK_LABEL (popup->label), "");
gtk_window_set_default_size (GTK_WINDOW (popup->window),
max_label_width + 20 /* random number */,
-1);
return popup; return popup;
} }

View File

@ -33,6 +33,14 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
typedef enum
{
META_IS_CONFIGURE_REQUEST = 1 << 0,
META_DO_GRAVITY_ADJUST = 1 << 1,
META_USER_RESIZE = 1 << 2,
META_USER_MOVE = 1 << 3
} MetaMoveResizeFlags;
static void constrain_size (MetaWindow *window, static void constrain_size (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameGeometry *fgeom,
int width, int width,
@ -83,14 +91,14 @@ static void adjust_for_gravity (MetaWindow *window,
int y, int y,
int *xp, int *xp,
int *yp); int *yp);
static void meta_window_move_resize_internal (MetaWindow *window,
gboolean is_configure_request, static void meta_window_move_resize_internal (MetaWindow *window,
gboolean do_gravity_adjust, MetaMoveResizeFlags flags,
int resize_gravity, int resize_gravity,
int root_x_nw, int root_x_nw,
int root_y_nw, int root_y_nw,
int w, int w,
int h); int h);
void meta_window_move_resize_now (MetaWindow *window); void meta_window_move_resize_now (MetaWindow *window);
@ -250,6 +258,7 @@ meta_window_new (MetaDisplay *display, Window xwindow,
/* And this is our unmaximized size */ /* And this is our unmaximized size */
window->saved_rect = window->rect; window->saved_rect = window->rect;
window->user_rect = window->rect;
window->depth = attrs.depth; window->depth = attrs.depth;
window->xvisual = attrs.visual; window->xvisual = attrs.visual;
@ -485,7 +494,8 @@ meta_window_new (MetaDisplay *display, Window xwindow,
* passing TRUE for is_configure_request, ICCCM says * passing TRUE for is_configure_request, ICCCM says
* initial map is handled same as configure request * initial map is handled same as configure request
*/ */
meta_window_move_resize_internal (window, TRUE, FALSE, meta_window_move_resize_internal (window,
META_IS_CONFIGURE_REQUEST,
NorthWestGravity, NorthWestGravity,
window->size_hints.x, window->size_hints.x,
window->size_hints.y, window->size_hints.y,
@ -604,7 +614,7 @@ meta_window_apply_session_info (MetaWindow *window,
x, y, w, h, window->desc); x, y, w, h, window->desc);
meta_window_move_resize_internal (window, meta_window_move_resize_internal (window,
FALSE, TRUE, META_DO_GRAVITY_ADJUST,
NorthWestGravity, NorthWestGravity,
x, y, w, h); x, y, w, h);
} }
@ -1077,6 +1087,7 @@ meta_window_unmaximize (MetaWindow *window)
window->maximized = FALSE; window->maximized = FALSE;
meta_window_move_resize (window, meta_window_move_resize (window,
TRUE,
window->saved_rect.x, window->saved_rect.x,
window->saved_rect.y, window->saved_rect.y,
window->saved_rect.width, window->saved_rect.width,
@ -1277,9 +1288,7 @@ adjust_for_gravity (MetaWindow *window,
static void static void
meta_window_move_resize_internal (MetaWindow *window, meta_window_move_resize_internal (MetaWindow *window,
gboolean is_configure_request, MetaMoveResizeFlags flags,
/* only relevant if !is_configure_request */
gboolean do_gravity_adjust,
int resize_gravity, int resize_gravity,
int root_x_nw, int root_x_nw,
int root_y_nw, int root_y_nw,
@ -1299,16 +1308,27 @@ meta_window_move_resize_internal (MetaWindow *window,
int pos_dx; int pos_dx;
int pos_dy; int pos_dy;
int frame_size_dx; int frame_size_dx;
int frame_size_dy; int frame_size_dy;
gboolean is_configure_request;
gboolean do_gravity_adjust;
gboolean is_user_resize;
gboolean is_user_move;
is_configure_request = (flags & META_IS_CONFIGURE_REQUEST) != 0;
do_gravity_adjust = (flags & META_DO_GRAVITY_ADJUST) != 0;
is_user_resize = (flags & META_USER_RESIZE) != 0;
is_user_move = (flags & META_USER_MOVE) != 0;
{ {
int oldx, oldy; int oldx, oldy;
meta_window_get_position (window, &oldx, &oldy); meta_window_get_position (window, &oldx, &oldy);
meta_verbose ("Move/resize %s to %d,%d %dx%d%s from %d,%d %dx%d\n", meta_verbose ("Move/resize %s to %d,%d %dx%d%s%s%s from %d,%d %dx%d\n",
window->desc, root_x_nw, root_y_nw, w, h, window->desc, root_x_nw, root_y_nw, w, h,
is_configure_request ? " (configure request)" : "", is_configure_request ? " (configure request)" : "",
is_user_resize ? " (user resize)" : "",
is_user_move ? " (user move)" : "",
oldx, oldy, window->rect.width, window->rect.height); oldx, oldy, window->rect.width, window->rect.height);
} }
if (window->frame) if (window->frame)
meta_frame_calc_geometry (window->frame, meta_frame_calc_geometry (window->frame,
@ -1549,6 +1569,22 @@ meta_window_move_resize_internal (MetaWindow *window,
if (need_configure_notify) if (need_configure_notify)
send_configure_notify (window); send_configure_notify (window);
if (is_user_resize)
{
window->user_has_resized = TRUE;
window->user_rect.width = window->rect.width;
window->user_rect.height = window->rect.height;
}
if (is_user_move)
{
window->user_has_moved = TRUE;
meta_window_get_position (window,
&window->user_rect.x,
&window->user_rect.y);
}
/* Invariants leaving this function are: /* Invariants leaving this function are:
* a) window->rect and frame->rect reflect the actual * a) window->rect and frame->rect reflect the actual
* server-side size/pos of window->xwindow and frame->xwindow * server-side size/pos of window->xwindow and frame->xwindow
@ -1558,6 +1594,7 @@ meta_window_move_resize_internal (MetaWindow *window,
void void
meta_window_resize (MetaWindow *window, meta_window_resize (MetaWindow *window,
gboolean user_op,
int w, int w,
int h) int h)
{ {
@ -1565,17 +1602,20 @@ meta_window_resize (MetaWindow *window,
meta_window_get_position (window, &x, &y); meta_window_get_position (window, &x, &y);
meta_window_move_resize_internal (window, FALSE, FALSE, meta_window_move_resize_internal (window,
user_op ? META_USER_RESIZE : 0,
NorthWestGravity, NorthWestGravity,
x, y, w, h); x, y, w, h);
} }
void void
meta_window_move (MetaWindow *window, meta_window_move (MetaWindow *window,
gboolean user_op,
int root_x_nw, int root_x_nw,
int root_y_nw) int root_y_nw)
{ {
meta_window_move_resize_internal (window, FALSE, FALSE, meta_window_move_resize_internal (window,
user_op ? META_USER_MOVE : 0,
NorthWestGravity, NorthWestGravity,
root_x_nw, root_y_nw, root_x_nw, root_y_nw,
window->rect.width, window->rect.width,
@ -1584,12 +1624,14 @@ meta_window_move (MetaWindow *window,
void void
meta_window_move_resize (MetaWindow *window, meta_window_move_resize (MetaWindow *window,
gboolean user_op,
int root_x_nw, int root_x_nw,
int root_y_nw, int root_y_nw,
int w, int w,
int h) int h)
{ {
meta_window_move_resize_internal (window, FALSE, FALSE, meta_window_move_resize_internal (window,
user_op ? META_USER_MOVE | META_USER_RESIZE : 0,
NorthWestGravity, NorthWestGravity,
root_x_nw, root_y_nw, root_x_nw, root_y_nw,
w, h); w, h);
@ -1597,6 +1639,7 @@ meta_window_move_resize (MetaWindow *window,
void void
meta_window_resize_with_gravity (MetaWindow *window, meta_window_resize_with_gravity (MetaWindow *window,
gboolean user_op,
int w, int w,
int h, int h,
int gravity) int gravity)
@ -1605,7 +1648,8 @@ meta_window_resize_with_gravity (MetaWindow *window,
meta_window_get_position (window, &x, &y); meta_window_get_position (window, &x, &y);
meta_window_move_resize_internal (window, FALSE, FALSE, meta_window_move_resize_internal (window,
user_op ? META_USER_RESIZE : 0,
gravity, gravity,
x, y, w, h); x, y, w, h);
} }
@ -1614,11 +1658,17 @@ void
meta_window_move_resize_now (MetaWindow *window) meta_window_move_resize_now (MetaWindow *window)
{ {
int x, y; int x, y;
/* If constraints have changed then we'll snap back to wherever
* the user had the window
*/
meta_window_get_user_position (window, &x, &y);
meta_window_get_position (window, &x, &y); meta_window_move_resize (window, FALSE, x, y,
window->user_has_resized ?
meta_window_move_resize (window, x, y, window->user_rect.width : window->rect.width,
window->rect.width, window->rect.height); window->user_has_resized ?
window->user_rect.height : window->rect.height);
} }
void void
@ -1649,6 +1699,24 @@ meta_window_get_position (MetaWindow *window,
} }
} }
void
meta_window_get_user_position (MetaWindow *window,
int *x,
int *y)
{
if (window->user_has_moved)
{
if (x)
*x = window->user_rect.x;
if (y)
*y = window->user_rect.y;
}
else
{
meta_window_get_position (window, x, y);
}
}
void void
meta_window_get_gravity_position (MetaWindow *window, meta_window_get_gravity_position (MetaWindow *window,
int *root_x, int *root_x,
@ -2060,7 +2128,7 @@ meta_window_configure_request (MetaWindow *window,
* move_resize_internal arguments. * move_resize_internal arguments.
*/ */
meta_window_move_resize_internal (window, TRUE, FALSE, meta_window_move_resize_internal (window, META_IS_CONFIGURE_REQUEST,
only_resize ? only_resize ?
window->size_hints.win_gravity : NorthWestGravity, window->size_hints.win_gravity : NorthWestGravity,
window->size_hints.x, window->size_hints.x,
@ -4600,7 +4668,6 @@ update_move (MetaWindow *window,
dx = x - window->display->grab_root_x; dx = x - window->display->grab_root_x;
dy = y - window->display->grab_root_y; dy = y - window->display->grab_root_y;
window->user_has_moved = TRUE;
new_x = window->display->grab_initial_window_pos.x + dx; new_x = window->display->grab_initial_window_pos.x + dx;
new_y = window->display->grab_initial_window_pos.y + dy; new_y = window->display->grab_initial_window_pos.y + dy;
@ -4611,7 +4678,7 @@ update_move (MetaWindow *window,
new_y = meta_window_find_nearest_horizontal_edge (window, new_y); new_y = meta_window_find_nearest_horizontal_edge (window, new_y);
} }
meta_window_move (window, new_x, new_y); meta_window_move (window, TRUE, new_x, new_y);
} }
static void static void
@ -4696,8 +4763,7 @@ update_resize (MetaWindow *window,
break; break;
} }
window->user_has_resized = TRUE; meta_window_resize_with_gravity (window, TRUE, new_w, new_h, gravity);
meta_window_resize_with_gravity (window, new_w, new_h, gravity);
} }
void void

View File

@ -156,8 +156,7 @@ struct _MetaWindow
guint has_focus : 1; guint has_focus : 1;
/* Track whether the user has ever manually modified /* Track whether the user has ever manually modified
* the window; if so, we remove some constraints * the window; if so, we can use the saved user size/pos
* that exist on program modifications.
*/ */
guint user_has_resized : 1; guint user_has_resized : 1;
guint user_has_moved : 1; guint user_has_moved : 1;
@ -191,7 +190,7 @@ struct _MetaWindow
* is withdrawing the window. * is withdrawing the window.
*/ */
int unmaps_pending; int unmaps_pending;
/* The size we set the window to last (i.e. what we believe /* The size we set the window to last (i.e. what we believe
* to be its actual size on the server). The x, y are * to be its actual size on the server). The x, y are
* the actual server-side x,y so are relative to the frame * the actual server-side x,y so are relative to the frame
@ -205,6 +204,17 @@ struct _MetaWindow
* above. * above.
*/ */
MetaRectangle saved_rect; MetaRectangle saved_rect;
/* This is the geometry the window had after the last user-initiated
* move/resize operations. We use this whenever we are moving the
* implicitly (for example, if we move to avoid a panel, we
* can snap back to this position if the panel moves again)
*
* Position valid if user_has_moved, size valid if user_has_resized
*
* Position always in root coords, unlike window->rect
*/
MetaRectangle user_rect;
/* Requested geometry */ /* Requested geometry */
int border_width; int border_width;
@ -235,17 +245,21 @@ void meta_window_unstick (MetaWindow *window);
/* args to move are window pos, not frame pos */ /* args to move are window pos, not frame pos */
void meta_window_move (MetaWindow *window, void meta_window_move (MetaWindow *window,
gboolean user_op,
int root_x_nw, int root_x_nw,
int root_y_nw); int root_y_nw);
void meta_window_resize (MetaWindow *window, void meta_window_resize (MetaWindow *window,
gboolean user_op,
int w, int w,
int h); int h);
void meta_window_move_resize (MetaWindow *window, void meta_window_move_resize (MetaWindow *window,
gboolean user_op,
int root_x_nw, int root_x_nw,
int root_y_nw, int root_y_nw,
int w, int w,
int h); int h);
void meta_window_resize_with_gravity (MetaWindow *window, void meta_window_resize_with_gravity (MetaWindow *window,
gboolean user_op,
int w, int w,
int h, int h,
int gravity); int gravity);
@ -259,6 +273,9 @@ void meta_window_queue_move_resize (MetaWindow *window);
void meta_window_get_position (MetaWindow *window, void meta_window_get_position (MetaWindow *window,
int *x, int *x,
int *y); int *y);
void meta_window_get_user_position (MetaWindow *window,
int *x,
int *y);
/* gets position we need to set to stay in current position, /* gets position we need to set to stay in current position,
* assuming position will be gravity-compensated. i.e. * assuming position will be gravity-compensated. i.e.
* this is the position a client would send in a configure * this is the position a client would send in a configure

View File

@ -44,7 +44,7 @@ main (int argc, char **argv)
gboolean do_evil; gboolean do_evil;
gboolean do_icon_windows; gboolean do_icon_windows;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
do_evil = FALSE; do_evil = FALSE;
do_icon_windows = FALSE; do_icon_windows = FALSE;
@ -185,8 +185,6 @@ set_up_icon_windows (void)
c = gtk_button_new_with_label ("Icon window"); c = gtk_button_new_with_label ("Icon window");
gtk_container_add (GTK_CONTAINER (w), c); gtk_container_add (GTK_CONTAINER (w), c);
gtk_widget_realize (w);
icons = NULL; icons = NULL;
pix = gtk_widget_render_icon (w, pix = gtk_widget_render_icon (w,
@ -213,9 +211,8 @@ set_up_icon_windows (void)
NULL); NULL);
icons = g_list_append (icons, pix); icons = g_list_append (icons, pix);
} }
if (!gdk_window_set_icon_list (w->window, icons)) gtk_window_set_icon_list (GTK_WINDOW (w), icons);
g_warning ("_NET_WM_ICON not supported?");
g_list_foreach (icons, (GFunc) g_object_unref, NULL); g_list_foreach (icons, (GFunc) g_object_unref, NULL);
g_list_free (icons); g_list_free (icons);