Commit a5d2c513 authored by Jasper St. Pierre's avatar Jasper St. Pierre

window: Move recalc_type to window-x11.c

It's only used by the X11 codepath.
parent d1ea17e6
......@@ -684,8 +684,6 @@ void meta_window_update_layer (MetaWindow *window);
void meta_window_recalc_features (MetaWindow *window);
/* recalc_window_type is x11 only, wayland does its thing and then calls type_changed */
void meta_window_recalc_window_type (MetaWindow *window);
void meta_window_type_changed (MetaWindow *window);
void meta_window_frame_size_changed (MetaWindow *window);
......
......@@ -727,7 +727,7 @@ reload_net_wm_state (MetaWindow *window,
meta_verbose ("Reloaded _NET_WM_STATE for %s\n",
window->desc);
meta_window_recalc_window_type (window);
meta_window_x11_recalc_window_type (window);
meta_window_recalc_features (window);
}
......
......@@ -226,7 +226,7 @@ meta_window_x11_update_net_wm_type (MetaWindow *window)
meta_XFree (str);
}
meta_window_recalc_window_type (window);
meta_window_x11_recalc_window_type (window);
}
void
......@@ -872,7 +872,7 @@ meta_window_x11_client_message (MetaWindow *window,
(action == _NET_WM_STATE_ADD) ||
(action == _NET_WM_STATE_TOGGLE && !window->wm_state_modal);
meta_window_recalc_window_type (window);
meta_window_x11_recalc_window_type (window);
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
}
......@@ -1506,3 +1506,118 @@ error:
meta_error_trap_pop (display);
return NULL;
}
void
meta_window_x11_recalc_window_type (MetaWindow *window)
{
MetaWindowType old_type;
old_type = window->type;
if (window->type_atom != None)
{
if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
window->type = META_WINDOW_DESKTOP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK)
window->type = META_WINDOW_DOCK;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR)
window->type = META_WINDOW_TOOLBAR;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU)
window->type = META_WINDOW_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY)
window->type = META_WINDOW_UTILITY;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH)
window->type = META_WINDOW_SPLASHSCREEN;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG)
window->type = META_WINDOW_DIALOG;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
window->type = META_WINDOW_NORMAL;
/* The below are *typically* override-redirect windows, but the spec does
* not disallow using them for managed windows.
*/
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
window->type = META_WINDOW_DROPDOWN_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
window->type = META_WINDOW_POPUP_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
window->type = META_WINDOW_TOOLTIP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
window->type = META_WINDOW_NOTIFICATION;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO)
window->type = META_WINDOW_COMBO;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
window->type = META_WINDOW_DND;
else
{
char *atom_name;
/*
* Fallback on a normal type, and print warning. Don't abort.
*/
window->type = META_WINDOW_NORMAL;
meta_error_trap_push (window->display);
atom_name = XGetAtomName (window->display->xdisplay,
window->type_atom);
meta_error_trap_pop (window->display);
meta_warning ("Unrecognized type atom [%s] set for %s \n",
atom_name ? atom_name : "unknown",
window->desc);
if (atom_name)
XFree (atom_name);
}
}
else if (window->transient_for != NULL)
{
window->type = META_WINDOW_DIALOG;
}
else
{
window->type = META_WINDOW_NORMAL;
}
if (window->type == META_WINDOW_DIALOG &&
window->wm_state_modal)
window->type = META_WINDOW_MODAL_DIALOG;
/* We don't want to allow override-redirect windows to have decorated-window
* types since that's just confusing.
*/
if (window->override_redirect)
{
switch (window->type)
{
/* Decorated types */
case META_WINDOW_NORMAL:
case META_WINDOW_DIALOG:
case META_WINDOW_MODAL_DIALOG:
case META_WINDOW_MENU:
case META_WINDOW_UTILITY:
window->type = META_WINDOW_OVERRIDE_OTHER;
break;
/* Undecorated types, normally not override-redirect */
case META_WINDOW_DESKTOP:
case META_WINDOW_DOCK:
case META_WINDOW_TOOLBAR:
case META_WINDOW_SPLASHSCREEN:
/* Undecorated types, normally override-redirect types */
case META_WINDOW_DROPDOWN_MENU:
case META_WINDOW_POPUP_MENU:
case META_WINDOW_TOOLTIP:
case META_WINDOW_NOTIFICATION:
case META_WINDOW_COMBO:
case META_WINDOW_DND:
/* To complete enum */
case META_WINDOW_OVERRIDE_OTHER:
break;
}
}
meta_verbose ("Calculated type %u for %s, old type %u\n",
window->type, window->desc, old_type);
if (old_type != window->type)
meta_window_type_changed (window);
}
......@@ -35,6 +35,8 @@ void meta_window_x11_update_opaque_region (MetaWindow *window);
void meta_window_x11_update_input_region (MetaWindow *window);
void meta_window_x11_update_shape_region (MetaWindow *window);
void meta_window_x11_recalc_window_type (MetaWindow *window);
gboolean meta_window_x11_configure_request (MetaWindow *window,
XEvent *event);
gboolean meta_window_x11_property_notify (MetaWindow *window,
......
......@@ -7064,121 +7064,6 @@ meta_window_update_struts (MetaWindow *window)
}
}
void
meta_window_recalc_window_type (MetaWindow *window)
{
MetaWindowType old_type;
old_type = window->type;
if (window->type_atom != None)
{
if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
window->type = META_WINDOW_DESKTOP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DOCK)
window->type = META_WINDOW_DOCK;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLBAR)
window->type = META_WINDOW_TOOLBAR;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_MENU)
window->type = META_WINDOW_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_UTILITY)
window->type = META_WINDOW_UTILITY;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_SPLASH)
window->type = META_WINDOW_SPLASHSCREEN;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DIALOG)
window->type = META_WINDOW_DIALOG;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
window->type = META_WINDOW_NORMAL;
/* The below are *typically* override-redirect windows, but the spec does
* not disallow using them for managed windows.
*/
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
window->type = META_WINDOW_DROPDOWN_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
window->type = META_WINDOW_POPUP_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
window->type = META_WINDOW_TOOLTIP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
window->type = META_WINDOW_NOTIFICATION;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO)
window->type = META_WINDOW_COMBO;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
window->type = META_WINDOW_DND;
else
{
char *atom_name;
/*
* Fallback on a normal type, and print warning. Don't abort.
*/
window->type = META_WINDOW_NORMAL;
meta_error_trap_push (window->display);
atom_name = XGetAtomName (window->display->xdisplay,
window->type_atom);
meta_error_trap_pop (window->display);
meta_warning ("Unrecognized type atom [%s] set for %s \n",
atom_name ? atom_name : "unknown",
window->desc);
if (atom_name)
XFree (atom_name);
}
}
else if (window->transient_for != NULL)
{
window->type = META_WINDOW_DIALOG;
}
else
{
window->type = META_WINDOW_NORMAL;
}
if (window->type == META_WINDOW_DIALOG &&
window->wm_state_modal)
window->type = META_WINDOW_MODAL_DIALOG;
/* We don't want to allow override-redirect windows to have decorated-window
* types since that's just confusing.
*/
if (window->override_redirect)
{
switch (window->type)
{
/* Decorated types */
case META_WINDOW_NORMAL:
case META_WINDOW_DIALOG:
case META_WINDOW_MODAL_DIALOG:
case META_WINDOW_MENU:
case META_WINDOW_UTILITY:
window->type = META_WINDOW_OVERRIDE_OTHER;
break;
/* Undecorated types, normally not override-redirect */
case META_WINDOW_DESKTOP:
case META_WINDOW_DOCK:
case META_WINDOW_TOOLBAR:
case META_WINDOW_SPLASHSCREEN:
/* Undecorated types, normally override-redirect types */
case META_WINDOW_DROPDOWN_MENU:
case META_WINDOW_POPUP_MENU:
case META_WINDOW_TOOLTIP:
case META_WINDOW_NOTIFICATION:
case META_WINDOW_COMBO:
case META_WINDOW_DND:
/* To complete enum */
case META_WINDOW_OVERRIDE_OTHER:
break;
}
}
meta_verbose ("Calculated type %u for %s, old type %u\n",
window->type, window->desc, old_type);
if (old_type != window->type)
meta_window_type_changed (window);
}
void
meta_window_type_changed (MetaWindow *window)
{
......@@ -10258,7 +10143,8 @@ meta_window_set_transient_for (MetaWindow *window,
meta_window_propagate_focus_appearance (window, FALSE);
/* may now be a dialog */
meta_window_recalc_window_type (window);
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
meta_window_x11_recalc_window_type (window);
if (!window->constructing)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment