This commit is contained in:
rhp 2001-06-23 06:54:28 +00:00
parent c1251f5d9c
commit f9c2652e0d
9 changed files with 91 additions and 38 deletions

View File

@ -37,7 +37,8 @@ typedef enum
META_FRAME_HAS_FOCUS = 1 << 6, META_FRAME_HAS_FOCUS = 1 << 6,
META_FRAME_SHADED = 1 << 7, META_FRAME_SHADED = 1 << 7,
META_FRAME_STUCK = 1 << 8, META_FRAME_STUCK = 1 << 8,
META_FRAME_MAXIMIZED = 1 << 9 META_FRAME_MAXIMIZED = 1 << 9,
META_FRAME_ALLOWS_SHADE = 1 << 10
} MetaFrameFlags; } MetaFrameFlags;
typedef enum typedef enum

View File

@ -275,6 +275,21 @@ meta_display_open (const char *name)
display->atom_net_wm_name, display->atom_net_wm_name,
"Metacity"); "Metacity");
{
/* The legacy GNOME hint is to set a cardinal which is the window
* id of the supporting_wm_check window on the supporting_wm_check
* window itself
*/
gulong data[1];
data[0] = display->leader_window;
XChangeProperty (display->xdisplay,
display->leader_window,
display->atom_win_supporting_wm_check,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
}
/* Now manage all existing windows */ /* Now manage all existing windows */
tmp = display->screens; tmp = display->screens;
while (tmp != NULL) while (tmp != NULL)

View File

@ -167,20 +167,17 @@ meta_frame_get_flags (MetaFrame *frame)
flags = flags =
META_FRAME_ALLOWS_MENU | META_FRAME_ALLOWS_RESIZE; META_FRAME_ALLOWS_MENU | META_FRAME_ALLOWS_RESIZE;
if (frame->window->maximized)
flags |= META_FRAME_MAXIMIZED;
if (frame->window->has_close_func) if (frame->window->has_close_func)
flags |= META_FRAME_ALLOWS_DELETE; flags |= META_FRAME_ALLOWS_DELETE;
if (frame->window->type == META_WINDOW_NORMAL) if (frame->window->has_maximize_func)
flags |= (META_FRAME_ALLOWS_MINIMIZE | META_FRAME_ALLOWS_MAXIMIZE); flags |= META_FRAME_ALLOWS_MAXIMIZE;
if (!frame->window->has_maximize_func) if (frame->window->has_minimize_func)
flags &= ~META_FRAME_ALLOWS_MAXIMIZE; flags |= META_FRAME_ALLOWS_MINIMIZE;
if (!frame->window->has_minimize_func) if (frame->window->has_shade_func)
flags &= ~META_FRAME_ALLOWS_MINIMIZE; flags |= META_FRAME_ALLOWS_SHADE;
if (frame->window->has_focus) if (frame->window->has_focus)
flags |= META_FRAME_HAS_FOCUS; flags |= META_FRAME_HAS_FOCUS;
@ -191,6 +188,9 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->on_all_workspaces) if (frame->window->on_all_workspaces)
flags |= META_FRAME_STUCK; flags |= META_FRAME_STUCK;
if (frame->window->maximized)
flags |= META_FRAME_MAXIMIZED;
return flags; return flags;
} }

View File

@ -966,12 +966,15 @@ meta_frames_button_press_event (GtkWidget *widget,
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow); flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
if (flags & META_FRAME_ALLOWS_SHADE)
{
if (flags & META_FRAME_SHADED) if (flags & META_FRAME_SHADED)
meta_core_unshade (gdk_display, meta_core_unshade (gdk_display,
frame->xwindow); frame->xwindow);
else else
meta_core_shade (gdk_display, meta_core_shade (gdk_display,
frame->xwindow); frame->xwindow);
}
return TRUE; return TRUE;
} }

View File

@ -187,6 +187,11 @@ meta_window_grab_keys (MetaWindow *window)
return; /* already all good */ return; /* already all good */
} }
/* no keybindings for Emacs ;-) */
if (window->res_class &&
g_strcasecmp (window->res_class, "Emacs") == 0)
return;
grab_keys (window_bindings, window->display, grab_keys (window_bindings, window->display,
window->frame ? window->frame->xwindow : window->xwindow); window->frame ? window->frame->xwindow : window->xwindow);

View File

@ -54,7 +54,7 @@ set_wm_check_hint (MetaScreen *screen)
/* Legacy GNOME hint */ /* Legacy GNOME hint */
XChangeProperty (screen->display->xdisplay, screen->xroot, XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_win_supporting_wm_check, screen->display->atom_win_supporting_wm_check,
XA_WINDOW, XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1); 32, PropModeReplace, (guchar*) data, 1);
return Success; return Success;

View File

@ -258,7 +258,7 @@ compute_layer (MetaWindow *window)
break; break;
case META_WINDOW_DOCK: case META_WINDOW_DOCK:
window->layer = META_WINDOW_DOCK; window->layer = META_LAYER_DOCK;
break; break;
default: default:
@ -493,8 +493,6 @@ meta_stack_sync_to_server (MetaStack *stack)
{ {
MetaStackLayer old_layer; MetaStackLayer old_layer;
old_layer = op->window->layer;
if (op->add_order >= 0) if (op->add_order >= 0)
{ {
/* need to add to a layer */ /* need to add to a layer */
@ -503,6 +501,8 @@ meta_stack_sync_to_server (MetaStack *stack)
op->window); op->window);
} }
old_layer = op->window->layer;
if (op->update_layer) if (op->update_layer)
{ {
compute_layer (op->window); compute_layer (op->window);
@ -572,12 +572,18 @@ meta_stack_sync_to_server (MetaStack *stack)
stack->pending = NULL; stack->pending = NULL;
stack->n_added = 0; stack->n_added = 0;
/* Create stacked xwindow arrays */ /* Create stacked xwindow arrays.
* Painfully, "stacked" is in bottom-to-top order for the
* _NET hints, and "root_children_stacked" is in top-to-bottom
* order for XRestackWindows()
*/
stacked = g_array_new (FALSE, FALSE, sizeof (Window)); stacked = g_array_new (FALSE, FALSE, sizeof (Window));
root_children_stacked = g_array_new (FALSE, FALSE, sizeof (Window)); root_children_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
i = 0; i = META_LAYER_LAST;
while (i < META_LAYER_LAST) do
{ {
--i;
/* Sort each layer... */ /* Sort each layer... */
if (needs_sort[i]) if (needs_sort[i])
{ {
@ -593,8 +599,10 @@ meta_stack_sync_to_server (MetaStack *stack)
{ {
MetaWindow *w = tmp->data; MetaWindow *w = tmp->data;
g_array_append_val (stacked, w->xwindow); /* remember, stacked is in reverse order (bottom to top) */
g_array_prepend_val (stacked, w->xwindow);
/* build XRestackWindows() array from top to bottom */
if (w->frame) if (w->frame)
g_array_append_val (root_children_stacked, w->frame->xwindow); g_array_append_val (root_children_stacked, w->frame->xwindow);
else else
@ -607,9 +615,8 @@ meta_stack_sync_to_server (MetaStack *stack)
meta_verbose ("\n"); meta_verbose ("\n");
meta_pop_no_msg_prefix (); meta_pop_no_msg_prefix ();
++i;
} }
while (i > 0);
/* All windows should be in some stacking order */ /* All windows should be in some stacking order */
if (stacked->len != stack->windows->len) if (stacked->len != stack->windows->len)

View File

@ -221,6 +221,7 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->has_close_func = TRUE; window->has_close_func = TRUE;
window->has_minimize_func = TRUE; window->has_minimize_func = TRUE;
window->has_maximize_func = TRUE; window->has_maximize_func = TRUE;
window->has_shade_func = TRUE;
window->wm_state_modal = FALSE; window->wm_state_modal = FALSE;
window->wm_state_skip_taskbar = FALSE; window->wm_state_skip_taskbar = FALSE;
@ -285,11 +286,10 @@ meta_window_new (MetaDisplay *display, Window xwindow,
meta_workspace_add_window (space, window); meta_workspace_add_window (space, window);
/* Ignore USPosition on transients because the app is full /* Only accept USPosition on normal windows because the app is full
* of shit claiming the user set -geometry for a dialog * of shit claiming the user set -geometry for a dialog or dock
*/ */
if (window->type != META_WINDOW_DIALOG && if (window->type == META_WINDOW_NORMAL &&
window->type != META_WINDOW_MODAL_DIALOG &&
(window->size_hints.flags & USPosition)) (window->size_hints.flags & USPosition))
{ {
/* don't constrain with placement algorithm */ /* don't constrain with placement algorithm */
@ -297,6 +297,27 @@ meta_window_new (MetaDisplay *display, Window xwindow,
meta_verbose ("Honoring USPosition for %s instead of using placement algorithm\n", window->desc); meta_verbose ("Honoring USPosition for %s instead of using placement algorithm\n", window->desc);
} }
if (window->type != META_WINDOW_NORMAL)
{
window->placed = TRUE;
meta_verbose ("Not placing non-normal-type window\n");
}
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK)
{
/* Change around the defaults */
window->on_all_workspaces = TRUE;
window->has_close_func = FALSE;
window->has_shade_func = FALSE;
}
if (window->type != META_WINDOW_NORMAL)
{
window->has_minimize_func = FALSE;
window->has_maximize_func = FALSE;
}
/* Put our state back where it should be, /* Put our state back where it should be,
* 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
@ -2969,9 +2990,6 @@ meta_window_show_menu (MetaWindow *window,
else else
ops |= META_MENU_OP_MAXIMIZE; ops |= META_MENU_OP_MAXIMIZE;
if (!window->has_maximize_func)
insensitive |= META_MENU_OP_UNMAXIMIZE | META_MENU_OP_MAXIMIZE;
if (window->shaded) if (window->shaded)
ops |= META_MENU_OP_UNSHADE; ops |= META_MENU_OP_UNSHADE;
else else
@ -2982,12 +3000,18 @@ meta_window_show_menu (MetaWindow *window,
else else
ops |= META_MENU_OP_STICK; ops |= META_MENU_OP_STICK;
if (!window->has_maximize_func)
insensitive |= META_MENU_OP_UNMAXIMIZE | META_MENU_OP_MAXIMIZE;
if (!window->has_minimize_func) if (!window->has_minimize_func)
insensitive |= META_MENU_OP_MINIMIZE; insensitive |= META_MENU_OP_MINIMIZE;
if (!window->has_close_func) if (!window->has_close_func)
insensitive |= META_MENU_OP_DELETE; insensitive |= META_MENU_OP_DELETE;
if (!window->has_shade_func)
insensitive |= META_MENU_OP_SHADE | META_MENU_OP_UNSHADE;
menu = menu =
meta_ui_window_menu_new (window->screen->ui, meta_ui_window_menu_new (window->screen->ui,
window->xwindow, window->xwindow,

View File

@ -104,13 +104,11 @@ struct _MetaWindow
/* Globally active / No input */ /* Globally active / No input */
guint input : 1; guint input : 1;
/* MWM hints */ /* Features of window */
guint decorated : 1; guint decorated : 1;
guint has_close_func : 1; guint has_close_func : 1;
guint has_minimize_func : 1; guint has_minimize_func : 1;
guint has_maximize_func : 1; guint has_maximize_func : 1;
/* similar hints */
guint has_shade_func : 1; guint has_shade_func : 1;
/* Weird "_NET_WM_STATE_MODAL" flag */ /* Weird "_NET_WM_STATE_MODAL" flag */