core/window: Reformat window.c
This commit uses uncrustify's output with some changes to reformat parts of window.c. No functional change intended. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4297>
This commit is contained in:
parent
adf49decb1
commit
eed9858459
@ -129,7 +129,7 @@
|
||||
* start after the end of the XID space so that, for stacking
|
||||
* we can keep a guint64 that represents one or the other
|
||||
*/
|
||||
static guint64 next_window_stamp = G_GUINT64_CONSTANT(0x100000000);
|
||||
static guint64 next_window_stamp = G_GUINT64_CONSTANT (0x100000000);
|
||||
|
||||
static void invalidate_work_areas (MetaWindow *window);
|
||||
static void set_wm_state (MetaWindow *window);
|
||||
@ -901,7 +901,7 @@ static gboolean
|
||||
meta_window_update_flatpak_id (MetaWindow *window,
|
||||
uint32_t pid)
|
||||
{
|
||||
g_autoptr(GKeyFile) key_file = NULL;
|
||||
g_autoptr (GKeyFile) key_file = NULL;
|
||||
g_autofree char *info_filename = NULL;
|
||||
|
||||
g_return_val_if_fail (pid != 0, FALSE);
|
||||
@ -910,10 +910,12 @@ meta_window_update_flatpak_id (MetaWindow *window,
|
||||
key_file = g_key_file_new ();
|
||||
info_filename = g_strdup_printf ("/proc/%u/root/.flatpak-info", pid);
|
||||
|
||||
if (!g_key_file_load_from_file (key_file, info_filename, G_KEY_FILE_NONE, NULL))
|
||||
if (!g_key_file_load_from_file (key_file, info_filename,
|
||||
G_KEY_FILE_NONE, NULL))
|
||||
return FALSE;
|
||||
|
||||
window->sandboxed_app_id = g_key_file_get_string (key_file, "Application", "name", NULL);
|
||||
window->sandboxed_app_id = g_key_file_get_string (key_file, "Application",
|
||||
"name", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -994,9 +996,11 @@ meta_window_update_desc (MetaWindow *window)
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
window->desc = g_strdup_printf ("0x%lx (%s)",
|
||||
meta_window_x11_get_xwindow (window),
|
||||
window->title ? window->title : "[untitled]");
|
||||
{
|
||||
window->desc = g_strdup_printf ("0x%lx (%s)",
|
||||
meta_window_x11_get_xwindow (window),
|
||||
window->title ? window->title : "[untitled]");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@ -1239,24 +1243,32 @@ meta_window_constructed (GObject *object)
|
||||
* much we can do...except record the current time so that any children
|
||||
* can use this time as a fallback.
|
||||
*/
|
||||
if (!window->override_redirect && !window->net_wm_user_time_set) {
|
||||
/* First, maybe the app was launched with startup notification using an
|
||||
* obsolete version of the spec; use that timestamp if it exists.
|
||||
*/
|
||||
if (window->initial_timestamp_set)
|
||||
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
|
||||
* being recorded as a fallback for potential transients
|
||||
if (!window->override_redirect && !window->net_wm_user_time_set)
|
||||
{
|
||||
/* First, maybe the app was launched with startup notification using an
|
||||
* obsolete version of the spec; use that timestamp if it exists.
|
||||
*/
|
||||
window->net_wm_user_time = window->initial_timestamp;
|
||||
else if (window->transient_for != NULL)
|
||||
meta_window_set_user_time (window, window->transient_for->net_wm_user_time);
|
||||
else
|
||||
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
|
||||
* being recorded as a fallback for potential transients
|
||||
*/
|
||||
window->net_wm_user_time =
|
||||
meta_display_get_current_time_roundtrip (display);
|
||||
}
|
||||
if (window->initial_timestamp_set)
|
||||
{
|
||||
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
|
||||
* being recorded as a fallback for potential transients
|
||||
*/
|
||||
window->net_wm_user_time = window->initial_timestamp;
|
||||
}
|
||||
else if (window->transient_for != NULL)
|
||||
{
|
||||
meta_window_set_user_time (window,
|
||||
window->transient_for->net_wm_user_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
|
||||
* being recorded as a fallback for potential transients
|
||||
*/
|
||||
window->net_wm_user_time =
|
||||
meta_display_get_current_time_roundtrip (display);
|
||||
}
|
||||
}
|
||||
|
||||
window->attached = meta_window_should_attach_to_parent (window);
|
||||
if (window->attached)
|
||||
@ -1291,9 +1303,9 @@ meta_window_constructed (GObject *object)
|
||||
"Window %s is initially on all spaces",
|
||||
window->desc);
|
||||
|
||||
/* need to set on_all_workspaces first so that it will be
|
||||
* added to all the MRU lists
|
||||
*/
|
||||
/* need to set on_all_workspaces first so that it will be
|
||||
* added to all the MRU lists
|
||||
*/
|
||||
window->on_all_workspaces_requested = TRUE;
|
||||
|
||||
on_all_workspaces = TRUE;
|
||||
@ -1347,7 +1359,8 @@ meta_window_constructed (GObject *object)
|
||||
"Putting window %s on active workspace",
|
||||
window->desc);
|
||||
|
||||
set_workspace_state (window, FALSE, workspace_manager->active_workspace);
|
||||
set_workspace_state (window, FALSE,
|
||||
workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
meta_window_update_struts (window);
|
||||
@ -1705,7 +1718,7 @@ meta_window_showing_on_its_workspace (MetaWindow *window)
|
||||
{
|
||||
gboolean showing;
|
||||
gboolean is_desktop_or_dock;
|
||||
MetaWorkspace* workspace_of_window;
|
||||
MetaWorkspace *workspace_of_window;
|
||||
|
||||
showing = TRUE;
|
||||
|
||||
@ -1946,10 +1959,10 @@ intervening_user_event_occurred (MetaWindow *window)
|
||||
* merely a preliminary optimization. :)
|
||||
*/
|
||||
if ( ((window->net_wm_user_time_set == TRUE) &&
|
||||
(window->net_wm_user_time == 0))
|
||||
||
|
||||
(window->net_wm_user_time == 0))
|
||||
||
|
||||
((window->initial_timestamp_set == TRUE) &&
|
||||
(window->initial_timestamp == 0)))
|
||||
(window->initial_timestamp == 0)))
|
||||
{
|
||||
meta_topic (META_DEBUG_STARTUP,
|
||||
"window %s explicitly requested no focus",
|
||||
@ -2018,8 +2031,8 @@ intervening_user_event_occurred (MetaWindow *window)
|
||||
*/
|
||||
static void
|
||||
window_state_on_map (MetaWindow *window,
|
||||
gboolean *takes_focus,
|
||||
gboolean *places_on_top)
|
||||
gboolean *takes_focus,
|
||||
gboolean *places_on_top)
|
||||
{
|
||||
gboolean intervening_events;
|
||||
|
||||
@ -2085,7 +2098,8 @@ window_state_on_map (MetaWindow *window,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
windows_overlap (const MetaWindow *w1, const MetaWindow *w2)
|
||||
windows_overlap (const MetaWindow *w1,
|
||||
const MetaWindow *w2)
|
||||
{
|
||||
MtkRectangle w1rect, w2rect;
|
||||
meta_window_get_frame_rect (w1, &w1rect);
|
||||
@ -2385,7 +2399,7 @@ meta_window_show (MetaWindow *window)
|
||||
if (!window->placed)
|
||||
{
|
||||
if (window->monitor &&
|
||||
meta_prefs_get_auto_maximize() &&
|
||||
meta_prefs_get_auto_maximize () &&
|
||||
window->showing_for_first_time &&
|
||||
window->has_maximize_func)
|
||||
{
|
||||
@ -2519,7 +2533,7 @@ meta_window_show (MetaWindow *window)
|
||||
window->showing_for_first_time = FALSE;
|
||||
if (takes_focus_on_map)
|
||||
{
|
||||
guint32 timestamp;
|
||||
guint32 timestamp;
|
||||
|
||||
timestamp = meta_display_get_current_time_roundtrip (window->display);
|
||||
|
||||
@ -2661,7 +2675,7 @@ static gboolean
|
||||
queue_calc_showing_func (MetaWindow *window,
|
||||
void *data)
|
||||
{
|
||||
meta_window_queue(window, META_QUEUE_CALC_SHOWING);
|
||||
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2682,7 +2696,7 @@ meta_window_minimize (MetaWindow *window)
|
||||
{
|
||||
window->minimized = TRUE;
|
||||
window->pending_compositor_effect = META_COMP_EFFECT_MINIMIZE;
|
||||
meta_window_queue(window, META_QUEUE_CALC_SHOWING);
|
||||
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
|
||||
|
||||
meta_window_foreach_transient (window,
|
||||
queue_calc_showing_func,
|
||||
@ -2714,7 +2728,7 @@ meta_window_unminimize (MetaWindow *window)
|
||||
{
|
||||
window->minimized = FALSE;
|
||||
window->pending_compositor_effect = META_COMP_EFFECT_UNMINIMIZE;
|
||||
meta_window_queue(window, META_QUEUE_CALC_SHOWING);
|
||||
meta_window_queue (window, META_QUEUE_CALC_SHOWING);
|
||||
|
||||
meta_window_foreach_transient (window,
|
||||
queue_calc_showing_func,
|
||||
@ -2752,9 +2766,9 @@ ensure_size_hints_satisfied (MtkRectangle *rect,
|
||||
* constraints, so one last fix.
|
||||
*/
|
||||
if (rect->width < minw)
|
||||
rect->width += ((minw - rect->width)/winc + 1)*winc;
|
||||
rect->width += ((minw - rect->width) / winc + 1) * winc;
|
||||
if (rect->height < minh)
|
||||
rect->height += ((minh - rect->height)/hinc + 1)*hinc;
|
||||
rect->height += ((minh - rect->height) / hinc + 1) * hinc;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2978,7 +2992,8 @@ meta_window_is_monitor_sized (MetaWindow *window)
|
||||
MtkRectangle window_rect, monitor_rect;
|
||||
|
||||
meta_window_get_frame_rect (window, &window_rect);
|
||||
meta_display_get_monitor_geometry (window->display, window->monitor->number, &monitor_rect);
|
||||
meta_display_get_monitor_geometry (window->display, window->monitor->number,
|
||||
&monitor_rect);
|
||||
|
||||
if (mtk_rectangle_equal (&window_rect, &monitor_rect))
|
||||
return TRUE;
|
||||
@ -3356,11 +3371,12 @@ meta_window_unmaximize (MetaWindow *window,
|
||||
target_rect = old_frame_rect;
|
||||
|
||||
/* Avoid unmaximizing to "almost maximized" size when the previous size
|
||||
* is greater then 80% of the work area use MAX_UNMAXIMIZED_WINDOW_AREA of the work area as upper limit
|
||||
* while maintaining the aspect ratio.
|
||||
* is greater then 80% of the work area use MAX_UNMAXIMIZED_WINDOW_AREA of
|
||||
* the work area as upper limit while maintaining the aspect ratio.
|
||||
*/
|
||||
if (unmaximize_horizontally && unmaximize_vertically &&
|
||||
desired_rect->width * desired_rect->height > work_area.width * work_area.height * MAX_UNMAXIMIZED_WINDOW_AREA)
|
||||
desired_rect->width * desired_rect->height >
|
||||
work_area.width * work_area.height * MAX_UNMAXIMIZED_WINDOW_AREA)
|
||||
{
|
||||
if (desired_rect->width > desired_rect->height)
|
||||
{
|
||||
@ -3598,7 +3614,7 @@ meta_window_update_fullscreen_monitors (MetaWindow *window,
|
||||
|
||||
if (meta_window_is_fullscreen (window))
|
||||
{
|
||||
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
|
||||
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3661,7 +3677,7 @@ meta_window_activate_full (MetaWindow *window,
|
||||
"last_user_time (%u) is more recent; ignoring "
|
||||
" _NET_ACTIVE_WINDOW message.",
|
||||
window->display->last_user_time);
|
||||
meta_window_set_demands_attention(window);
|
||||
meta_window_set_demands_attention (window);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3737,7 +3753,8 @@ meta_window_activate_with_workspace (MetaWindow *window,
|
||||
{
|
||||
g_return_if_fail (!window->override_redirect);
|
||||
|
||||
meta_window_activate_full (window, timestamp, META_CLIENT_TYPE_APPLICATION, workspace);
|
||||
meta_window_activate_full (window, timestamp, META_CLIENT_TYPE_APPLICATION,
|
||||
workspace);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4386,21 +4403,22 @@ adjust_size_for_tile_match (MetaWindow *window,
|
||||
if (!meta_window_is_tiled_side_by_side (window) || !tile_match)
|
||||
return;
|
||||
|
||||
meta_window_get_work_area_for_monitor (window, window->tile_monitor_number, &work_area);
|
||||
meta_window_get_work_area_for_monitor (window, window->tile_monitor_number,
|
||||
&work_area);
|
||||
|
||||
/* Make sure the resize does not break minimum sizes */
|
||||
rect = work_area;
|
||||
rect.width = *new_w;
|
||||
|
||||
meta_window_frame_rect_to_client_rect (window, &rect, &rect);
|
||||
*new_w += MAX(0, window->size_hints.min_width - rect.width);
|
||||
*new_w += MAX (0, window->size_hints.min_width - rect.width);
|
||||
|
||||
/* Make sure we're not resizing the tile match below its min width */
|
||||
rect = work_area;
|
||||
rect.width = work_area.width - *new_w;
|
||||
|
||||
meta_window_frame_rect_to_client_rect (tile_match, &rect, &rect);
|
||||
*new_w -= MAX(0, tile_match->size_hints.min_width - rect.width);
|
||||
*new_w -= MAX (0, tile_match->size_hints.min_width - rect.width);
|
||||
}
|
||||
|
||||
void
|
||||
@ -4614,8 +4632,8 @@ meta_window_get_client_area_rect (MetaWindow *window,
|
||||
rect->x = borders.total.left;
|
||||
rect->y = borders.total.top;
|
||||
|
||||
rect->width = window->buffer_rect.width - borders.total.left - borders.total.right;
|
||||
rect->height = window->buffer_rect.height - borders.total.top - borders.total.bottom;
|
||||
rect->width = window->buffer_rect.width - borders.total.left - borders.total.right;
|
||||
rect->height = window->buffer_rect.height - borders.total.top - borders.total.bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4843,7 +4861,7 @@ meta_window_focus (MetaWindow *window,
|
||||
meta_close_dialog_focus (window->close_dialog);
|
||||
|
||||
if (window->wm_state_demands_attention)
|
||||
meta_window_unset_demands_attention(window);
|
||||
meta_window_unset_demands_attention (window);
|
||||
|
||||
/* meta_effect_run_focus(window, NULL, NULL); */
|
||||
}
|
||||
@ -4879,7 +4897,8 @@ set_workspace_state (MetaWindow *window,
|
||||
* to mark as on_all_workspaces, or when unmanaging to remove all the
|
||||
* workspaces. */
|
||||
if (window->override_redirect)
|
||||
g_return_if_fail ((window->constructing && on_all_workspaces) || window->unmanaging);
|
||||
g_return_if_fail ((window->constructing && on_all_workspaces)
|
||||
|| window->unmanaging);
|
||||
|
||||
if (on_all_workspaces == window->on_all_workspaces &&
|
||||
workspace == window->workspace &&
|
||||
@ -5268,10 +5287,10 @@ meta_window_lower_with_transients (MetaWindow *window,
|
||||
|
||||
lower_window_and_transients (window, NULL);
|
||||
|
||||
/* Rather than try to figure that out whether we just lowered
|
||||
* the focus window, assume that's always the case. (Typically,
|
||||
* this will be invoked via keyboard action or by a mouse action;
|
||||
* in either case the window or a modal child will have been focused.) */
|
||||
/* Rather than try to figure that out whether we just lowered
|
||||
* the focus window, assume that's always the case. (Typically,
|
||||
* this will be invoked via keyboard action or by a mouse action;
|
||||
* in either case the window or a modal child will have been focused.) */
|
||||
meta_workspace_focus_default_window (workspace_manager->active_workspace,
|
||||
NULL,
|
||||
timestamp);
|
||||
@ -5305,7 +5324,8 @@ meta_window_change_workspace_by_index (MetaWindow *window,
|
||||
meta_workspace_manager_get_workspace_by_index (workspace_manager, space_index);
|
||||
|
||||
if (!workspace && append)
|
||||
workspace = meta_workspace_manager_append_new_workspace (workspace_manager, FALSE, META_CURRENT_TIME);
|
||||
workspace = meta_workspace_manager_append_new_workspace (workspace_manager,
|
||||
FALSE, META_CURRENT_TIME);
|
||||
|
||||
if (workspace)
|
||||
meta_window_change_workspace (window, workspace);
|
||||
@ -5442,7 +5462,7 @@ meta_window_set_focused_internal (MetaWindow *window,
|
||||
*/
|
||||
#ifdef HAVE_X11
|
||||
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
|
||||
!meta_prefs_get_raise_on_click())
|
||||
!meta_prefs_get_raise_on_click ())
|
||||
{
|
||||
meta_x11_keybindings_ungrab_focus_window_button (&window->display->key_binding_manager,
|
||||
window);
|
||||
@ -5650,7 +5670,7 @@ meta_window_recalc_skip_features (MetaWindow *window)
|
||||
{
|
||||
switch (window->type)
|
||||
{
|
||||
/* Force skip taskbar/pager on these window types */
|
||||
/* Force skip taskbar/pager on these window types */
|
||||
case META_WINDOW_DESKTOP:
|
||||
case META_WINDOW_DOCK:
|
||||
case META_WINDOW_TOOLBAR:
|
||||
@ -6069,7 +6089,7 @@ meta_window_foreach_transient (MetaWindow *window,
|
||||
|
||||
if (meta_window_is_ancestor_of_transient (window, transient))
|
||||
{
|
||||
if (!(* func) (transient, user_data))
|
||||
if (!(*func) (transient, user_data))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6103,7 +6123,7 @@ meta_window_foreach_ancestor (MetaWindow *window,
|
||||
|
||||
w = w->transient_for;
|
||||
}
|
||||
while (w && (* func) (w, user_data));
|
||||
while (w && (*func) (w, user_data));
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@ -6234,9 +6254,9 @@ ensure_mru_position_after (MetaWindow *window,
|
||||
*/
|
||||
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
GList* active_mru_list;
|
||||
GList* window_position;
|
||||
GList* after_this_one_position;
|
||||
GList *active_mru_list;
|
||||
GList *window_position;
|
||||
GList *after_this_one_position;
|
||||
|
||||
active_mru_list = workspace_manager->active_workspace->mru_list;
|
||||
window_position = g_list_find (active_mru_list, window);
|
||||
@ -6459,9 +6479,9 @@ meta_window_set_demands_attention (MetaWindow *window)
|
||||
/* If the window's in full view, there's no point setting the flag. */
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Not marking %s as needing attention because "
|
||||
"it's in full view",
|
||||
window->desc);
|
||||
"Not marking %s as needing attention because "
|
||||
"it's in full view",
|
||||
window->desc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6747,7 +6767,8 @@ meta_window_get_compositor_private (MetaWindow *window)
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_set_compositor_private (MetaWindow *window, GObject *priv)
|
||||
meta_window_set_compositor_private (MetaWindow *window,
|
||||
GObject *priv)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
@ -7499,7 +7520,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
unmodified = (event_mods & grab_mods) == 0;
|
||||
source = clutter_event_get_source_device (event);
|
||||
is_window_button_grab_allowed = !display->focus_window ||
|
||||
!meta_window_shortcuts_inhibited (display->focus_window, source);
|
||||
!meta_window_shortcuts_inhibited (display->focus_window, source);
|
||||
is_window_grab = (is_window_button_grab_allowed &&
|
||||
((event_mods & grab_mods) == grab_mods));
|
||||
|
||||
@ -8246,7 +8267,7 @@ meta_window_stage_to_protocol_point (MetaWindow *window,
|
||||
* by the stage and internal window management logic.
|
||||
*/
|
||||
void
|
||||
meta_window_protocol_to_stage_rect (MetaWindow *window,
|
||||
meta_window_protocol_to_stage_rect (MetaWindow *window,
|
||||
const MtkRectangle *protocol_rect,
|
||||
MtkRectangle *stage_rect)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user