mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
...
This commit is contained in:
parent
b46ab7cab3
commit
f14221e842
@ -185,6 +185,11 @@ meta_display_open (const char *name)
|
|||||||
display->atom_net_wm_state_modal = atoms[27];
|
display->atom_net_wm_state_modal = atoms[27];
|
||||||
display->atom_net_client_list = atoms[28];
|
display->atom_net_client_list = atoms[28];
|
||||||
display->atom_net_client_list_stacking = atoms[29];
|
display->atom_net_client_list_stacking = atoms[29];
|
||||||
|
|
||||||
|
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
||||||
|
* created in screen_new
|
||||||
|
*/
|
||||||
|
display->leader_window = None;
|
||||||
|
|
||||||
screens = NULL;
|
screens = NULL;
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -225,13 +230,6 @@ meta_display_open (const char *name)
|
|||||||
display->last_button_num = 0;
|
display->last_button_num = 0;
|
||||||
display->is_double_click = FALSE;
|
display->is_double_click = FALSE;
|
||||||
|
|
||||||
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK
|
|
||||||
*/
|
|
||||||
display->leader_window =
|
|
||||||
XCreateSimpleWindow (display->xdisplay,
|
|
||||||
((MetaScreen*)display->screens->data)->xroot,
|
|
||||||
-100, -100, 1, 1, 0, 0, 0);
|
|
||||||
|
|
||||||
set_string_hint (display,
|
set_string_hint (display,
|
||||||
display->leader_window,
|
display->leader_window,
|
||||||
display->atom_net_supporting_wm_check,
|
display->atom_net_supporting_wm_check,
|
||||||
@ -303,7 +301,8 @@ meta_display_close (MetaDisplay *display)
|
|||||||
*/
|
*/
|
||||||
g_hash_table_destroy (display->window_ids);
|
g_hash_table_destroy (display->window_ids);
|
||||||
|
|
||||||
XDestroyWindow (display->xdisplay, display->leader_window);
|
if (display->leader_window != None)
|
||||||
|
XDestroyWindow (display->xdisplay, display->leader_window);
|
||||||
|
|
||||||
meta_event_queue_free (display->events);
|
meta_event_queue_free (display->events);
|
||||||
XCloseDisplay (display->xdisplay);
|
XCloseDisplay (display->xdisplay);
|
||||||
@ -720,7 +719,62 @@ event_get_modified_window (MetaDisplay *display,
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
focus_detail (int d)
|
||||||
|
{
|
||||||
|
const char *detail = "(????)";
|
||||||
|
switch (d)
|
||||||
|
{
|
||||||
|
case NotifyAncestor:
|
||||||
|
detail = "NotifyAncestor";
|
||||||
|
break;
|
||||||
|
case NotifyDetailNone:
|
||||||
|
detail = "NotifyDetailNone";
|
||||||
|
break;
|
||||||
|
case NotifyInferior:
|
||||||
|
detail = "NotifyInferior";
|
||||||
|
break;
|
||||||
|
case NotifyNonlinear:
|
||||||
|
detail = "NotifyNonlinear";
|
||||||
|
break;
|
||||||
|
case NotifyNonlinearVirtual:
|
||||||
|
detail = "NotifyNonlinearVirtual";
|
||||||
|
break;
|
||||||
|
case NotifyPointer:
|
||||||
|
detail = "NotifyPointer";
|
||||||
|
break;
|
||||||
|
case NotifyPointerRoot:
|
||||||
|
detail = "NotifyPointerRoot";
|
||||||
|
break;
|
||||||
|
case NotifyVirtual:
|
||||||
|
detail = "NotifyVirtual";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char*
|
||||||
|
focus_mode (int m)
|
||||||
|
{
|
||||||
|
const char *mode = "(????)";
|
||||||
|
switch (m)
|
||||||
|
{
|
||||||
|
case NotifyNormal:
|
||||||
|
mode = "NotifyNormal";
|
||||||
|
break;
|
||||||
|
case NotifyGrab:
|
||||||
|
mode = "NotifyGrab";
|
||||||
|
break;
|
||||||
|
case NotifyUngrab:
|
||||||
|
mode = "NotifyUngrab";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_spew_event (MetaDisplay *display,
|
meta_spew_event (MetaDisplay *display,
|
||||||
XEvent *event)
|
XEvent *event)
|
||||||
@ -773,9 +827,15 @@ meta_spew_event (MetaDisplay *display,
|
|||||||
break;
|
break;
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
name = "FocusIn";
|
name = "FocusIn";
|
||||||
|
extra = g_strdup_printf ("detail: %s mode: %s\n",
|
||||||
|
focus_detail (event->xfocus.detail),
|
||||||
|
focus_mode (event->xfocus.mode));
|
||||||
break;
|
break;
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
name = "FocusOut";
|
name = "FocusOut";
|
||||||
|
extra = g_strdup_printf ("detail: %s mode: %s\n",
|
||||||
|
focus_detail (event->xfocus.detail),
|
||||||
|
focus_mode (event->xfocus.mode));
|
||||||
break;
|
break;
|
||||||
case KeymapNotify:
|
case KeymapNotify:
|
||||||
name = "KeymapNotify";
|
name = "KeymapNotify";
|
||||||
|
13
src/screen.c
13
src/screen.c
@ -47,6 +47,8 @@ set_wm_check_hint (MetaScreen *screen)
|
|||||||
{
|
{
|
||||||
unsigned long data[1];
|
unsigned long data[1];
|
||||||
|
|
||||||
|
g_return_val_if_fail (screen->display->leader_window != None, 0);
|
||||||
|
|
||||||
data[0] = screen->display->leader_window;
|
data[0] = screen->display->leader_window;
|
||||||
|
|
||||||
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
||||||
@ -59,9 +61,9 @@ set_wm_check_hint (MetaScreen *screen)
|
|||||||
static int
|
static int
|
||||||
set_supported_hint (MetaScreen *screen)
|
set_supported_hint (MetaScreen *screen)
|
||||||
{
|
{
|
||||||
#define N_SUPPORTED 17
|
#define N_SUPPORTED 19
|
||||||
Atom atoms[N_SUPPORTED];
|
Atom atoms[N_SUPPORTED];
|
||||||
|
|
||||||
atoms[0] = screen->display->atom_net_wm_name;
|
atoms[0] = screen->display->atom_net_wm_name;
|
||||||
atoms[1] = screen->display->atom_net_close_window;
|
atoms[1] = screen->display->atom_net_close_window;
|
||||||
atoms[2] = screen->display->atom_net_wm_state;
|
atoms[2] = screen->display->atom_net_wm_state;
|
||||||
@ -79,6 +81,8 @@ set_supported_hint (MetaScreen *screen)
|
|||||||
atoms[14] = screen->display->atom_net_wm_window_type_dialog;
|
atoms[14] = screen->display->atom_net_wm_window_type_dialog;
|
||||||
atoms[15] = screen->display->atom_net_wm_window_type_normal;
|
atoms[15] = screen->display->atom_net_wm_window_type_normal;
|
||||||
atoms[16] = screen->display->atom_net_wm_state_modal;
|
atoms[16] = screen->display->atom_net_wm_state_modal;
|
||||||
|
atoms[17] = screen->display->atom_net_client_list;
|
||||||
|
atoms[18] = screen->display->atom_net_client_list_stacking;
|
||||||
|
|
||||||
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
||||||
screen->display->atom_net_wm_supported,
|
screen->display->atom_net_wm_supported,
|
||||||
@ -153,6 +157,11 @@ meta_screen_new (MetaDisplay *display,
|
|||||||
|
|
||||||
screen->showing_tooltip = FALSE;
|
screen->showing_tooltip = FALSE;
|
||||||
|
|
||||||
|
if (display->leader_window == None)
|
||||||
|
display->leader_window = XCreateSimpleWindow (display->xdisplay,
|
||||||
|
screen->xroot,
|
||||||
|
-100, -100, 1, 1, 0, 0, 0);
|
||||||
|
|
||||||
set_supported_hint (screen);
|
set_supported_hint (screen);
|
||||||
|
|
||||||
set_wm_check_hint (screen);
|
set_wm_check_hint (screen);
|
||||||
|
@ -55,6 +55,8 @@ struct _MetaScreen
|
|||||||
* root window)
|
* root window)
|
||||||
*/
|
*/
|
||||||
PangoContext *pango_context;
|
PangoContext *pango_context;
|
||||||
|
|
||||||
|
MetaStack *stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaScreen* meta_screen_new (MetaDisplay *display,
|
MetaScreen* meta_screen_new (MetaDisplay *display,
|
||||||
|
183
src/stack.c
183
src/stack.c
@ -22,6 +22,7 @@
|
|||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
|
#include "frame.h"
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
@ -166,6 +167,7 @@ meta_stack_remove (MetaStack *stack,
|
|||||||
op->add_order = -1;
|
op->add_order = -1;
|
||||||
|
|
||||||
/* Need to immediately remove from layer lists */
|
/* Need to immediately remove from layer lists */
|
||||||
|
g_assert (g_list_find (stack->layers[window->layer], window) != NULL);
|
||||||
stack->layers[window->layer] =
|
stack->layers[window->layer] =
|
||||||
g_list_remove (stack->layers[window->layer], window);
|
g_list_remove (stack->layers[window->layer], window);
|
||||||
|
|
||||||
@ -206,6 +208,7 @@ meta_stack_raise (MetaStack *stack,
|
|||||||
op = ensure_op (stack, window);
|
op = ensure_op (stack, window);
|
||||||
op->raised = TRUE;
|
op->raised = TRUE;
|
||||||
op->lowered = FALSE;
|
op->lowered = FALSE;
|
||||||
|
op->update_transient = TRUE;
|
||||||
|
|
||||||
meta_stack_sync_to_server (stack);
|
meta_stack_sync_to_server (stack);
|
||||||
}
|
}
|
||||||
@ -219,6 +222,7 @@ meta_stack_lower (MetaStack *stack,
|
|||||||
op = ensure_op (stack, window);
|
op = ensure_op (stack, window);
|
||||||
op->raised = FALSE;
|
op->raised = FALSE;
|
||||||
op->lowered = TRUE;
|
op->lowered = TRUE;
|
||||||
|
op->update_transient = TRUE;
|
||||||
|
|
||||||
meta_stack_sync_to_server (stack);
|
meta_stack_sync_to_server (stack);
|
||||||
}
|
}
|
||||||
@ -261,51 +265,91 @@ compute_layer (MetaWindow *window)
|
|||||||
window->desc, window->layer);
|
window->desc, window->layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GList*
|
||||||
is_transient_for (MetaWindow *transient,
|
ensure_before (GList *list,
|
||||||
MetaWindow *parent)
|
gconstpointer before,
|
||||||
|
gconstpointer value)
|
||||||
{
|
{
|
||||||
MetaWindow *w;
|
/* ensure before is before value */
|
||||||
|
GList *b_link;
|
||||||
|
GList *v_link;
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
w = transient;
|
b_link = NULL;
|
||||||
while (w != NULL)
|
v_link = NULL;
|
||||||
|
tmp = list;
|
||||||
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
if (w->xtransient_for == None)
|
if (tmp->data == before)
|
||||||
return FALSE;
|
{
|
||||||
|
if (v_link == NULL)
|
||||||
w = meta_display_lookup_x_window (w->display, w->xtransient_for);
|
return list; /* already before */
|
||||||
|
|
||||||
if (w == transient)
|
b_link = tmp;
|
||||||
return FALSE; /* Cycle detected */
|
}
|
||||||
else if (w == parent)
|
else if (tmp->data == value)
|
||||||
return TRUE;
|
{
|
||||||
|
v_link = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
/* We weren't already before if we got here */
|
||||||
}
|
list = g_list_remove_link (list, b_link);
|
||||||
|
|
||||||
static int
|
if (v_link == list)
|
||||||
window_stack_cmp (MetaWindow *a,
|
|
||||||
MetaWindow *b)
|
|
||||||
{
|
|
||||||
/* Less than means higher in stacking, i.e. at the
|
|
||||||
* front of the list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (a->xtransient_for != None &&
|
|
||||||
is_transient_for (a, b))
|
|
||||||
{
|
{
|
||||||
/* a is higher than b due to transient_for */
|
b_link->next = v_link;
|
||||||
return -1;
|
v_link->prev = b_link;
|
||||||
}
|
list = b_link;
|
||||||
else if (b->xtransient_for != None &&
|
|
||||||
is_transient_for (b, a))
|
|
||||||
{
|
|
||||||
/* b is higher than a due to transient_for */
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0; /* leave things as-is */
|
{
|
||||||
|
b_link->prev = v_link->prev;
|
||||||
|
b_link->prev->next = b_link;
|
||||||
|
b_link->next = v_link;
|
||||||
|
v_link->prev = b_link;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList*
|
||||||
|
sort_window_list (GList *list)
|
||||||
|
{
|
||||||
|
GList *tmp;
|
||||||
|
GList *copy;
|
||||||
|
|
||||||
|
/* This algorithm could stand to be a bit less
|
||||||
|
* quadratic
|
||||||
|
*/
|
||||||
|
copy = g_list_copy (list);
|
||||||
|
tmp = copy;
|
||||||
|
while (tmp != NULL)
|
||||||
|
{
|
||||||
|
MetaWindow *w = tmp->data;
|
||||||
|
|
||||||
|
if (w->xtransient_for != None)
|
||||||
|
{
|
||||||
|
MetaWindow *parent;
|
||||||
|
|
||||||
|
parent =
|
||||||
|
meta_display_lookup_x_window (w->display, w->xtransient_for);
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
meta_verbose ("Stacking %s above %s due to transiency\n",
|
||||||
|
w->desc, parent->desc);
|
||||||
|
list = ensure_before (list, w, parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
g_list_free (copy);
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -321,6 +365,7 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
int i, j;
|
int i, j;
|
||||||
int old_size;
|
int old_size;
|
||||||
GArray *stacked;
|
GArray *stacked;
|
||||||
|
GArray *root_children_stacked;
|
||||||
|
|
||||||
/* Bail out if frozen */
|
/* Bail out if frozen */
|
||||||
if (stack->freeze_count > 0)
|
if (stack->freeze_count > 0)
|
||||||
@ -445,6 +490,14 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
|
|
||||||
old_layer = op->window->layer;
|
old_layer = op->window->layer;
|
||||||
|
|
||||||
|
if (op->add_order >= 0)
|
||||||
|
{
|
||||||
|
/* need to add to a layer */
|
||||||
|
stack->layers[op->window->layer] =
|
||||||
|
g_list_prepend (stack->layers[op->window->layer],
|
||||||
|
op->window);
|
||||||
|
}
|
||||||
|
|
||||||
if (op->update_layer)
|
if (op->update_layer)
|
||||||
{
|
{
|
||||||
compute_layer (op->window);
|
compute_layer (op->window);
|
||||||
@ -486,6 +539,8 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
stack->layers[op->window->layer] =
|
stack->layers[op->window->layer] =
|
||||||
g_list_prepend (stack->layers[op->window->layer],
|
g_list_prepend (stack->layers[op->window->layer],
|
||||||
op->window);
|
op->window);
|
||||||
|
|
||||||
|
needs_sort[op->window->layer] = TRUE;
|
||||||
}
|
}
|
||||||
else if (op->lowered)
|
else if (op->lowered)
|
||||||
{
|
{
|
||||||
@ -496,44 +551,38 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
stack->layers[op->window->layer] =
|
stack->layers[op->window->layer] =
|
||||||
g_list_append (stack->layers[op->window->layer],
|
g_list_append (stack->layers[op->window->layer],
|
||||||
op->window);
|
op->window);
|
||||||
|
|
||||||
|
needs_sort[op->window->layer] = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op->window)
|
||||||
|
op->window->stack_op = NULL;
|
||||||
g_free (op);
|
g_free (op);
|
||||||
|
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free (stack->pending);
|
g_list_free (stack->pending);
|
||||||
stack->pending = NULL;
|
stack->pending = NULL;
|
||||||
stack->n_added = 0;
|
stack->n_added = 0;
|
||||||
|
|
||||||
/* Sort the layer lists */
|
/* Create stacked xwindow arrays */
|
||||||
i = 0;
|
stacked = g_array_new (FALSE, FALSE, sizeof (Window));
|
||||||
|
root_children_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
|
||||||
|
i = 0;
|
||||||
while (i < META_LAYER_LAST)
|
while (i < META_LAYER_LAST)
|
||||||
{
|
{
|
||||||
|
/* Sort each layer... */
|
||||||
if (needs_sort[i])
|
if (needs_sort[i])
|
||||||
{
|
{
|
||||||
stack->layers[i] =
|
meta_verbose ("Sorting layer %d\n", i);
|
||||||
g_list_sort (stack->layers[i],
|
stack->layers[i] = sort_window_list (stack->layers[i]);
|
||||||
(GCompareFunc) window_stack_cmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create stacked xwindow array */
|
|
||||||
stacked = g_array_new (FALSE, FALSE, sizeof (Window));
|
|
||||||
i = 0;
|
|
||||||
while (i < META_LAYER_LAST)
|
|
||||||
{
|
|
||||||
if (needs_sort[i])
|
|
||||||
{
|
|
||||||
stack->layers[i] =
|
|
||||||
g_list_sort (stack->layers[i],
|
|
||||||
(GCompareFunc) window_stack_cmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ... then append it */
|
||||||
|
meta_verbose ("Layer %d: ", i);
|
||||||
|
meta_push_no_msg_prefix ();
|
||||||
tmp = stack->layers[i];
|
tmp = stack->layers[i];
|
||||||
while (tmp != NULL)
|
while (tmp != NULL)
|
||||||
{
|
{
|
||||||
@ -541,8 +590,18 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
|
|
||||||
g_array_append_val (stacked, w->xwindow);
|
g_array_append_val (stacked, w->xwindow);
|
||||||
|
|
||||||
|
if (w->frame)
|
||||||
|
g_array_append_val (root_children_stacked, w->frame->xwindow);
|
||||||
|
else
|
||||||
|
g_array_append_val (root_children_stacked, w->xwindow);
|
||||||
|
|
||||||
|
meta_verbose ("%s ", w->desc);
|
||||||
|
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_verbose ("\n");
|
||||||
|
meta_pop_no_msg_prefix ();
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -554,10 +613,13 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
|
|
||||||
/* Sync to server */
|
/* Sync to server */
|
||||||
|
|
||||||
|
meta_verbose ("Restacking %d windows\n",
|
||||||
|
root_children_stacked->len);
|
||||||
|
|
||||||
meta_error_trap_push (stack->screen->display);
|
meta_error_trap_push (stack->screen->display);
|
||||||
XRestackWindows (stack->screen->display->xdisplay,
|
XRestackWindows (stack->screen->display->xdisplay,
|
||||||
(Window *) stacked->data,
|
(Window *) root_children_stacked->data,
|
||||||
stacked->len);
|
root_children_stacked->len);
|
||||||
meta_error_trap_pop (stack->screen->display);
|
meta_error_trap_pop (stack->screen->display);
|
||||||
/* on error, a window was destroyed; it should eventually
|
/* on error, a window was destroyed; it should eventually
|
||||||
* get removed from the stacking list when we unmanage it
|
* get removed from the stacking list when we unmanage it
|
||||||
@ -569,19 +631,20 @@ meta_stack_sync_to_server (MetaStack *stack)
|
|||||||
XChangeProperty (stack->screen->display->xdisplay,
|
XChangeProperty (stack->screen->display->xdisplay,
|
||||||
stack->screen->xroot,
|
stack->screen->xroot,
|
||||||
stack->screen->display->atom_net_client_list,
|
stack->screen->display->atom_net_client_list,
|
||||||
XA_ATOM,
|
XA_WINDOW,
|
||||||
32, PropModeReplace,
|
32, PropModeReplace,
|
||||||
stack->windows->data,
|
stack->windows->data,
|
||||||
stack->windows->len);
|
stack->windows->len);
|
||||||
XChangeProperty (stack->screen->display->xdisplay,
|
XChangeProperty (stack->screen->display->xdisplay,
|
||||||
stack->screen->xroot,
|
stack->screen->xroot,
|
||||||
stack->screen->display->atom_net_client_list_stacking,
|
stack->screen->display->atom_net_client_list_stacking,
|
||||||
XA_ATOM,
|
XA_WINDOW,
|
||||||
32, PropModeReplace,
|
32, PropModeReplace,
|
||||||
stacked->data,
|
stacked->data,
|
||||||
stacked->len);
|
stacked->len);
|
||||||
|
|
||||||
g_array_free (stacked, TRUE);
|
g_array_free (stacked, TRUE);
|
||||||
|
g_array_free (root_children_stacked, TRUE);
|
||||||
|
|
||||||
/* That was scary... */
|
/* That was scary... */
|
||||||
}
|
}
|
||||||
|
30
src/util.c
30
src/util.c
@ -29,6 +29,7 @@
|
|||||||
static gboolean is_verbose = FALSE;
|
static gboolean is_verbose = FALSE;
|
||||||
static gboolean is_debugging = FALSE;
|
static gboolean is_debugging = FALSE;
|
||||||
static gboolean is_syncing = FALSE;
|
static gboolean is_syncing = FALSE;
|
||||||
|
static int no_prefix = 0;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_is_verbose (void)
|
meta_is_verbose (void)
|
||||||
@ -95,7 +96,8 @@ meta_debug_spew (const char *format, ...)
|
|||||||
str = g_strdup_vprintf (format, args);
|
str = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
fputs ("Window manager: ", stderr);
|
if (no_prefix == 0)
|
||||||
|
fputs ("Window manager: ", stderr);
|
||||||
fputs (str, stderr);
|
fputs (str, stderr);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -116,7 +118,8 @@ meta_verbose (const char *format, ...)
|
|||||||
str = g_strdup_vprintf (format, args);
|
str = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
fputs ("Window manager: ", stderr);
|
if (no_prefix == 0)
|
||||||
|
fputs ("Window manager: ", stderr);
|
||||||
fputs (str, stderr);
|
fputs (str, stderr);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -134,7 +137,8 @@ meta_bug (const char *format, ...)
|
|||||||
str = g_strdup_vprintf (format, args);
|
str = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
fputs ("Bug in window manager: ", stderr);
|
if (no_prefix == 0)
|
||||||
|
fputs ("Bug in window manager: ", stderr);
|
||||||
fputs (str, stderr);
|
fputs (str, stderr);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -155,7 +159,8 @@ meta_warning (const char *format, ...)
|
|||||||
str = g_strdup_vprintf (format, args);
|
str = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
fputs ("Window manager: ", stderr);
|
if (no_prefix == 0)
|
||||||
|
fputs ("Window manager: ", stderr);
|
||||||
fputs (str, stderr);
|
fputs (str, stderr);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
@ -173,10 +178,25 @@ meta_fatal (const char *format, ...)
|
|||||||
str = g_strdup_vprintf (format, args);
|
str = g_strdup_vprintf (format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
fputs ("Window manager: ", stderr);
|
if (no_prefix == 0)
|
||||||
|
fputs ("Window manager: ", stderr);
|
||||||
fputs (str, stderr);
|
fputs (str, stderr);
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
meta_exit (META_EXIT_ERROR);
|
meta_exit (META_EXIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_push_no_msg_prefix (void)
|
||||||
|
{
|
||||||
|
++no_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_pop_no_msg_prefix (void)
|
||||||
|
{
|
||||||
|
g_return_if_fail (no_prefix > 0);
|
||||||
|
|
||||||
|
--no_prefix;
|
||||||
|
}
|
||||||
|
@ -53,6 +53,9 @@ void meta_warning (const char *format,
|
|||||||
void meta_fatal (const char *format,
|
void meta_fatal (const char *format,
|
||||||
...) G_GNUC_PRINTF (1, 2);
|
...) G_GNUC_PRINTF (1, 2);
|
||||||
|
|
||||||
|
void meta_push_no_msg_prefix (void);
|
||||||
|
void meta_pop_no_msg_prefix (void);
|
||||||
|
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#define _(x) x
|
#define _(x) x
|
||||||
|
30
src/window.c
30
src/window.c
@ -780,25 +780,25 @@ meta_window_focus (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
meta_verbose ("Setting input focus to window %s, input: %d take_focus: %d\n",
|
meta_verbose ("Setting input focus to window %s, input: %d take_focus: %d\n",
|
||||||
window->desc, window->input, window->take_focus);
|
window->desc, window->input, window->take_focus);
|
||||||
|
|
||||||
|
meta_error_trap_push (window->display);
|
||||||
|
|
||||||
if (window->input)
|
if (window->input)
|
||||||
{
|
{
|
||||||
meta_error_trap_push (window->display);
|
XSetInputFocus (window->display->xdisplay,
|
||||||
if (window->take_focus)
|
window->xwindow,
|
||||||
{
|
RevertToPointerRoot,
|
||||||
meta_window_send_icccm_message (window,
|
timestamp);
|
||||||
window->display->atom_wm_take_focus,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XSetInputFocus (window->display->xdisplay,
|
|
||||||
window->xwindow,
|
|
||||||
RevertToParent,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
meta_error_trap_pop (window->display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window->take_focus)
|
||||||
|
{
|
||||||
|
meta_window_send_icccm_message (window,
|
||||||
|
window->display->atom_wm_take_focus,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_error_trap_pop (window->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user