Browse Source

Imported Upstream version 2.2.1

upstream upstream/2.2.1
Margarita Manterola 10 years ago
parent
commit
dce5d2d84c
  1. 2
      autogen.sh
  2. 4
      configure.ac
  3. 2
      src/compositor/compositor.c
  4. 8
      src/compositor/meta-window-actor.c
  5. 2
      src/core/constraints.c
  6. 10
      src/core/core.c
  7. 3
      src/core/core.h
  8. 50
      src/core/display.c
  9. 20
      src/core/edge-resistance.c
  10. 42
      src/core/keybindings.c
  11. 44
      src/core/prefs.c
  12. 53
      src/core/screen.c
  13. 6
      src/core/session.c
  14. 8
      src/core/window-private.h
  15. 50
      src/core/window-props.c
  16. 91
      src/core/window.c
  17. 3
      src/core/workspace.c
  18. 1
      src/meta/atomnames.h
  19. 12
      src/meta/prefs.h
  20. 1
      src/meta/window.h
  21. 11
      src/org.cinnamon.muffin.gschema.xml.in
  22. 88
      src/ui/frames.c
  23. 4
      src/ui/theme-parser.c
  24. 2
      src/ui/theme-private.h
  25. 20
      src/ui/tile-hud.c
  26. 5
      src/ui/ui.c

2
autogen.sh

@ -7,7 +7,7 @@ test -z "$srcdir" && srcdir=.
PKG_NAME="muffin"
REQUIRED_AUTOMAKE_VERSION=1.10
(test -f $srcdir/configure.in \
(test -f $srcdir/configure.ac \
&& test -d $srcdir/src) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level muffin directory"

4
configure.in → configure.ac

@ -1,8 +1,8 @@
AC_PREREQ(2.50)
m4_define([muffin_major_version], [2])
m4_define([muffin_minor_version], [0])
m4_define([muffin_micro_version], [5])
m4_define([muffin_minor_version], [2])
m4_define([muffin_micro_version], [1])
m4_define([muffin_version],
[muffin_major_version.muffin_minor_version.muffin_micro_version])

2
src/compositor/compositor.c

@ -140,7 +140,7 @@ process_property_notify (MetaCompositor *compositor,
/* Check for the opacity changing */
if (event->atom == compositor->atom_net_wm_window_opacity)
{
{g_printerr ("REMOVE ME OPACITY ON COMPOSITOR\n");
meta_window_actor_update_opacity (window_actor);
DEBUG_TRACE ("process_property_notify: net_wm_window_opacity\n");
return;

8
src/compositor/meta-window-actor.c

@ -750,11 +750,9 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
meta_window_is_fullscreen (priv->window))
return FALSE;
/*
* If we have two snap-tiled windows, we don't want the shadow to obstruct
* the other window.
*/
if (meta_window_get_tile_match (priv->window))
/* Don't shadow tiled windows of any type */
if (meta_window_get_tile_type (priv->window) != META_WINDOW_TILE_TYPE_NONE)
return FALSE;
/*

2
src/core/constraints.c

@ -444,7 +444,7 @@ setup_constraint_info (ConstraintInfo *info,
* fullscreen themselves properly.
*/
if (meta_prefs_get_force_fullscreen() &&
window->decorated &&
(window->decorated || !meta_window_is_client_decorated (window)) &&
meta_rectangle_equal (new, &monitor_info->rect) &&
window->has_fullscreen_func &&
!window->fullscreen)

10
src/core/core.c

@ -494,6 +494,16 @@ meta_core_unmake_above (Display *xdisplay,
meta_window_unmake_above (window);
}
LOCAL_SYMBOL void
meta_core_adjust_opacity (Display *xdisplay,
Window frame_xwindow,
gboolean increase)
{
MetaWindow *window = get_window (xdisplay, frame_xwindow);
meta_window_adjust_opacity (window, increase);
}
LOCAL_SYMBOL void
meta_core_stick (Display *xdisplay,
Window frame_xwindow)

3
src/core/core.h

@ -154,6 +154,9 @@ void meta_core_unmake_above (Display *xdisplay,
Window frame_xwindow);
void meta_core_make_above (Display *xdisplay,
Window frame_xwindow);
void meta_core_adjust_opacity (Display *xdisplay,
Window frame_xwindow,
gboolean increase);
void meta_core_change_workspace (Display *xdisplay,
Window frame_xwindow,
int new_workspace);

50
src/core/display.c

@ -140,6 +140,8 @@ enum
WINDOW_MARKED_URGENT,
GRAB_OP_BEGIN,
GRAB_OP_END,
ZOOM_SCROLL_IN,
ZOOM_SCROLL_OUT,
LAST_SIGNAL
};
@ -285,6 +287,22 @@ meta_display_class_init (MetaDisplayClass *klass)
META_TYPE_WINDOW,
META_TYPE_GRAB_OP);
display_signals[ZOOM_SCROLL_IN] =
g_signal_new ("zoom-scroll-in",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
display_signals[ZOOM_SCROLL_OUT] =
g_signal_new ("zoom-scroll-out",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window",
@ -305,8 +323,10 @@ static void
ping_data_free (MetaPingData *ping_data)
{
/* Remove the timeout */
if (ping_data->ping_timeout_id != 0)
if (ping_data->ping_timeout_id != 0) {
g_source_remove (ping_data->ping_timeout_id);
ping_data->ping_timeout_id = 0;
}
g_free (ping_data);
}
@ -1554,8 +1574,10 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
auto_raise_data->display = window->display;
auto_raise_data->xwindow = window->xwindow;
if (display->autoraise_timeout_id != 0)
if (display->autoraise_timeout_id != 0) {
g_source_remove (display->autoraise_timeout_id);
display->autoraise_timeout_id = 0;
}
display->autoraise_timeout_id =
g_timeout_add_full (G_PRIORITY_DEFAULT,
@ -1807,8 +1829,22 @@ event_callback (XEvent *event,
break;
if (event->xbutton.button == 4 || event->xbutton.button == 5)
/* Scrollwheel event, do nothing and deliver event to compositor below */
break;
{
if (event->xbutton.state == display->window_grab_modifiers)
{
if (event->xbutton.button == 4)
{
g_signal_emit (display, display_signals[ZOOM_SCROLL_IN], 0);
}
if (event->xbutton.button == 5)
{
g_signal_emit (display, display_signals[ZOOM_SCROLL_OUT], 0);
}
filter_out_event = bypass_compositor = TRUE;
}
break;
}
if ((window &&
grab_op_is_mouse (display->grab_op) &&
@ -3966,6 +4002,8 @@ meta_display_grab_window_buttons (MetaDisplay *display,
* Grab Alt + button2 for resizing window.
* Grab Alt + button3 for popping up window menu.
* Grab Alt + Shift + button1 for snap-moving window.
* Grab Alt + button4 for scrolling in
* Grab Alt + button5 for scrolling out
*/
meta_verbose ("Grabbing window buttons for 0x%lx\n", xwindow);
@ -3978,7 +4016,7 @@ meta_display_grab_window_buttons (MetaDisplay *display,
{
gboolean debug = g_getenv ("MUFFIN_DEBUG_BUTTON_GRABS") != NULL;
int i;
for (i = 1; i < 4; i++)
for (i = 1; i < 6; i++)
{
meta_change_button_grab (display, xwindow,
TRUE,
@ -4020,7 +4058,7 @@ meta_display_ungrab_window_buttons (MetaDisplay *display,
debug = g_getenv ("MUFFIN_DEBUG_BUTTON_GRABS") != NULL;
i = 1;
while (i < 4)
while (i < 6)
{
meta_change_button_grab (display, xwindow,
FALSE, FALSE, i,

20
src/core/edge-resistance.c

@ -737,18 +737,22 @@ meta_display_cleanup_edges (MetaDisplay *display)
edge_data->bottom_edges = NULL;
/* Cleanup the timeouts */
if (edge_data->left_data.timeout_setup &&
edge_data->left_data.timeout_id != 0)
if (edge_data->left_data.timeout_setup && edge_data->left_data.timeout_id != 0) {
g_source_remove (edge_data->left_data.timeout_id);
if (edge_data->right_data.timeout_setup &&
edge_data->right_data.timeout_id != 0)
edge_data->left_data.timeout_id = 0;
}
if (edge_data->right_data.timeout_setup && edge_data->right_data.timeout_id != 0) {
g_source_remove (edge_data->right_data.timeout_id);
if (edge_data->top_data.timeout_setup &&
edge_data->top_data.timeout_id != 0)
edge_data->right_data.timeout_id = 0;
}
if (edge_data->top_data.timeout_setup && edge_data->top_data.timeout_id != 0) {
g_source_remove (edge_data->top_data.timeout_id);
if (edge_data->bottom_data.timeout_setup &&
edge_data->bottom_data.timeout_id != 0)
edge_data->top_data.timeout_id = 0;
}
if (edge_data->bottom_data.timeout_setup && edge_data->bottom_data.timeout_id != 0) {
g_source_remove (edge_data->bottom_data.timeout_id);
edge_data->bottom_data.timeout_id = 0;
}
g_free (display->grab_edge_resistance_data);
display->grab_edge_resistance_data = NULL;

42
src/core/keybindings.c

@ -2760,6 +2760,19 @@ handle_maximize_horizontally (MetaDisplay *display,
}
}
static void
handle_opacity (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaKeyBindingAction action = meta_prefs_get_keybinding_action (binding->name);
meta_window_adjust_opacity (window, action == META_KEYBINDING_ACTION_INCREASE_OPACITY);
}
/* Move a window to a corner; to_bottom/to_right are FALSE for the
* top or left edge, or TRUE for the bottom/right edge. xchange/ychange
* are FALSE if that dimension is not to be changed, TRUE otherwise.
@ -3367,6 +3380,18 @@ get_new_tile_mode (MetaTileMode direction,
case META_TILE_NONE:
ret = direction;
break;
case META_TILE_MAXIMIZE:
if (direction == META_TILE_LEFT)
ret = META_TILE_ULC;
else if (direction == META_TILE_RIGHT)
ret = META_TILE_URC;
else if (direction == META_TILE_TOP)
ret = direction;
else if (direction == META_TILE_BOTTOM)
ret = META_TILE_TOP;
else
ret = META_TILE_NONE;
break;
case META_TILE_LEFT:
if (direction == META_TILE_LEFT)
ret = META_TILE_LEFT;
@ -3393,7 +3418,7 @@ get_new_tile_mode (MetaTileMode direction,
else if (direction == META_TILE_RIGHT)
ret = META_TILE_URC;
else if (direction == META_TILE_TOP)
ret = META_TILE_TOP;
ret = META_TILE_MAXIMIZE;
else
ret = META_TILE_NONE;
break;
@ -3504,6 +3529,7 @@ handle_tile_action (MetaDisplay *display,
window->tile_monitor_number = window->monitor->number;
window->tile_mode = new_mode;
window->custom_snap_size = FALSE;
window->saved_maximize = FALSE;
/* Maximization constraints beat tiling constraints, so if the window
* is maximized, tiling won't have any effect unless we unmaximize it
* horizontally first; rather than calling meta_window_unmaximize(),
@ -4514,6 +4540,20 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
handle_move_to_center, 0);
add_builtin_keybinding (display,
"increase-opacity",
SCHEMA_MUFFIN_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_INCREASE_OPACITY,
handle_opacity, 0);
add_builtin_keybinding (display,
"decrease-opacity",
SCHEMA_MUFFIN_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_DECREASE_OPACITY,
handle_opacity, 0);
}
LOCAL_SYMBOL void

44
src/core/prefs.c

@ -86,6 +86,7 @@ static gboolean workspace_cycle = FALSE;
static CDesktopTitlebarAction action_double_click_titlebar = C_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
static CDesktopTitlebarAction action_middle_click_titlebar = C_DESKTOP_TITLEBAR_ACTION_LOWER;
static CDesktopTitlebarAction action_right_click_titlebar = C_DESKTOP_TITLEBAR_ACTION_MENU;
static CDesktopTitlebarScrollAction action_scroll_titlebar = C_DESKTOP_TITLEBAR_SCROLL_ACTION_NONE;
static gboolean dynamic_workspaces = FALSE;
static gboolean application_based = FALSE;
static gboolean disable_workarounds = FALSE;
@ -100,6 +101,7 @@ static int cursor_size = 24;
static int draggable_border_width = 10;
static int tile_hud_threshold = 150;
static int resize_threshold = 24;
static int ui_scale = 1;
static gboolean resize_with_right_button = FALSE;
static gboolean edge_tiling = FALSE;
static gboolean force_fullscreen = TRUE;
@ -267,6 +269,13 @@ static MetaEnumPreference preferences_enum[] =
},
&action_right_click_titlebar,
},
{
{ "action-scroll-titlebar",
SCHEMA_GENERAL,
META_PREF_ACTION_SCROLL_WHEEL_TITLEBAR,
},
&action_scroll_titlebar,
},
{
{ "placement-mode",
SCHEMA_MUFFIN,
@ -873,6 +882,17 @@ queue_changed (MetaPreference pref)
changed_idle_handler, NULL, NULL);
}
static void
update_ui_scale (GdkScreen *screen, gpointer data)
{
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_INT);
gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value);
ui_scale = g_value_get_int (&value);
}
/****************************************************************************/
/* Initialisation. */
@ -925,6 +945,13 @@ meta_prefs_init (void)
handle_preference_init_string ();
handle_preference_init_int ();
GdkDisplay *display = gdk_display_get_default();
g_signal_connect_swapped (gdk_display_get_default_screen (display), "monitors-changed",
G_CALLBACK (update_ui_scale), NULL);
update_ui_scale (gdk_display_get_default_screen (display), NULL);
init_bindings ();
init_workspace_names ();
}
@ -1211,7 +1238,7 @@ meta_prefs_get_cursor_theme (void)
int
meta_prefs_get_cursor_size (void)
{
return cursor_size;
return cursor_size * ui_scale;
}
@ -1703,6 +1730,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_ACTION_RIGHT_CLICK_TITLEBAR:
return "ACTION_RIGHT_CLICK_TITLEBAR";
case META_PREF_ACTION_SCROLL_WHEEL_TITLEBAR:
return "ACTION_SCROLL_WHEEL_TITLEBAR";
case META_PREF_AUTO_RAISE:
return "AUTO_RAISE";
@ -2244,6 +2274,12 @@ meta_prefs_get_action_right_click_titlebar (void)
return action_right_click_titlebar;
}
CDesktopTitlebarScrollAction
meta_prefs_get_action_scroll_wheel_titlebar (void)
{
return action_scroll_titlebar;
}
gboolean
meta_prefs_get_auto_raise (void)
{
@ -2390,19 +2426,19 @@ meta_prefs_set_no_tab_popup (gboolean whether)
int
meta_prefs_get_draggable_border_width (void)
{
return draggable_border_width;
return draggable_border_width * ui_scale;
}
int
meta_prefs_get_tile_hud_threshold (void)
{
return tile_hud_threshold;
return tile_hud_threshold * ui_scale;
}
int
meta_prefs_get_resize_threshold (void)
{
return resize_threshold;
return resize_threshold * ui_scale;
}
void

53
src/core/screen.c

@ -338,6 +338,8 @@ set_supported_hint (MetaScreen *screen)
#include <meta/atomnames.h>
#undef item
#undef EWMH_ATOMS_ONLY
screen->display->atom__GTK_FRAME_EXTENTS,
};
XChangeProperty (screen->display->xdisplay, screen->xroot,
@ -1057,26 +1059,36 @@ meta_screen_free (MetaScreen *screen,
XDestroyWindow (screen->display->xdisplay,
screen->wm_sn_selection_window);
if (screen->work_area_later != 0)
if (screen->work_area_later != 0) {
g_source_remove (screen->work_area_later);
screen->work_area_later = 0;
}
if (screen->monitor_infos)
g_free (screen->monitor_infos);
if (screen->tile_preview_timeout_id)
if (screen->tile_preview_timeout_id) {
g_source_remove (screen->tile_preview_timeout_id);
screen->tile_preview_timeout_id = 0;
}
if (screen->tile_preview)
meta_tile_preview_free (screen->tile_preview);
if (screen->tile_hud_timeout_id)
if (screen->tile_hud_timeout_id) {
g_source_remove (screen->tile_hud_timeout_id);
screen->tile_hud_timeout_id = 0;
}
if (screen->tile_hud_fade_timeout_id)
if (screen->tile_hud_fade_timeout_id) {
g_source_remove (screen->tile_hud_fade_timeout_id);
screen->tile_hud_fade_timeout_id = 0;
}
if (screen->snap_osd_timeout_id)
if (screen->snap_osd_timeout_id) {
g_source_remove (screen->snap_osd_timeout_id);
screen->snap_osd_timeout_id = 0;
}
if (screen->tile_hud)
meta_tile_hud_free (screen->tile_hud);
@ -2090,8 +2102,10 @@ meta_screen_tile_preview_update (MetaScreen *screen,
}
else
{
if (screen->tile_preview_timeout_id > 0)
if (screen->tile_preview_timeout_id > 0) {
g_source_remove (screen->tile_preview_timeout_id);
screen->tile_preview_timeout_id = 0;
}
meta_screen_tile_preview_update_timeout ((gpointer)screen);
}
@ -2100,8 +2114,10 @@ meta_screen_tile_preview_update (MetaScreen *screen,
LOCAL_SYMBOL void
meta_screen_tile_preview_hide (MetaScreen *screen)
{
if (screen->tile_preview_timeout_id > 0)
if (screen->tile_preview_timeout_id > 0) {
g_source_remove (screen->tile_preview_timeout_id);
screen->tile_preview_timeout_id = 0;
}
if (screen->tile_preview)
meta_tile_preview_hide (screen->tile_preview);
@ -2234,10 +2250,14 @@ meta_screen_tile_hud_update (MetaScreen *screen,
LOCAL_SYMBOL void
meta_screen_tile_hud_hide (MetaScreen *screen)
{
if (screen->tile_hud_timeout_id > 0)
if (screen->tile_hud_timeout_id > 0) {
g_source_remove (screen->tile_hud_timeout_id);
if (screen->tile_hud_fade_timeout_id > 0)
screen->tile_hud_timeout_id = 0;
}
if (screen->tile_hud_fade_timeout_id > 0) {
g_source_remove (screen->tile_hud_fade_timeout_id);
screen->tile_hud_fade_timeout_id = 0;
}
if (screen->tile_hud)
meta_tile_hud_hide (screen->tile_hud);
@ -3316,8 +3336,21 @@ meta_screen_toggle_desktop (MetaScreen *screen,
{
if (screen->active_workspace->showing_desktop)
{
/*
* dirty hack because the actual window to be focused after unshowing the desktop
* lost its focus when showing desktop
* and therefore is second in the MRU list
*/
MetaWindow *not_this_one;
not_this_one = meta_stack_get_default_focus_window(screen->stack,
screen->active_workspace,
NULL);
meta_screen_unshow_desktop (screen);
meta_workspace_focus_default_window (screen->active_workspace,
meta_workspace_focus_default_window (screen->active_workspace,
not_this_one,
timestamp);
// If there's only one window, make sure it gets the focus
meta_workspace_focus_default_window (screen->active_workspace,
NULL,
timestamp);
}

6
src/core/session.c

@ -146,8 +146,10 @@ new_ice_connection (IceConn connection, IcePointer client_data, Bool opening,
else
{
input_id = GPOINTER_TO_UINT ((gpointer) *watch_data);
g_source_remove (input_id);
if (input_id) {
g_source_remove (input_id);
input_id = 0;
}
}
}

8
src/core/window-private.h

@ -418,6 +418,9 @@ struct _MetaWindow
*/
MetaRectangle rect;
gboolean has_custom_frame_extents;
GtkBorder custom_frame_extents;
/* The geometry to restore when we unmaximize. The position is in
* root window coords, even if there's a frame, which contrasts with
* window->rect above. Note that this gives the position and size
@ -561,6 +564,8 @@ void meta_window_shade (MetaWindow *window,
guint32 timestamp);
void meta_window_unshade (MetaWindow *window,
guint32 timestamp);
void meta_window_adjust_opacity (MetaWindow *window,
gboolean increase);
void meta_window_change_workspace (MetaWindow *window,
MetaWorkspace *workspace);
void meta_window_stick (MetaWindow *window);
@ -785,4 +790,7 @@ void meta_window_set_tile_type (MetaWindow *window,
MetaWindowTileType type);
MetaWindowTileType meta_window_get_tile_type (MetaWindow *window);
gboolean meta_window_is_client_decorated (MetaWindow *window);
#endif

50
src/core/window-props.c

@ -283,6 +283,35 @@ reload_kwm_win_icon (MetaWindow *window,
reload_icon (window, window->display->atom__KWM_WIN_ICON);
}
static void
reload_gtk_frame_extents (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
if (value->type != META_PROP_VALUE_INVALID)
{
if (value->v.cardinal_list.n_cardinals != 4)
{
meta_verbose ("_GTK_FRAME_EXTENTS on %s has %d values instead of 4\n",
window->desc, value->v.cardinal_list.n_cardinals);
}
else
{
GtkBorder *extents = &window->custom_frame_extents;
window->has_custom_frame_extents = TRUE;
extents->left = (int)value->v.cardinal_list.cardinals[0];
extents->right = (int)value->v.cardinal_list.cardinals[1];
extents->top = (int)value->v.cardinal_list.cardinals[2];
extents->bottom = (int)value->v.cardinal_list.cardinals[3];
}
}
else
{
window->has_custom_frame_extents = FALSE;
}
}
static void
reload_struts (MetaWindow *window,
MetaPropValue *value,
@ -660,14 +689,24 @@ reload_net_wm_state (MetaWindow *window,
if (value->type == META_PROP_VALUE_INVALID)
return;
i = 0;
while (i < value->v.atom_list.n_atoms)
{
if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_TILED)
window->tile_after_placement = TRUE;
++i;
}
i = 0;
while (i < value->v.atom_list.n_atoms)
{
if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_SHADED)
window->shaded = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ &&
!window->tile_after_placement)
window->maximize_horizontally_after_placement = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_VERT)
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_MAXIMIZED_VERT &&
!window->tile_after_placement)
window->maximize_vertically_after_placement = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_HIDDEN)
window->minimize_after_placement = TRUE;
@ -687,8 +726,6 @@ reload_net_wm_state (MetaWindow *window,
window->wm_state_demands_attention = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_STICKY)
window->on_all_workspaces_requested = TRUE;
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_TILED)
window->tile_after_placement = TRUE;
++i;
}
@ -1725,9 +1762,10 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id, TRUE, FALSE },
{ display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8, reload_gtk_unique_bus_name, TRUE, FALSE },
{ display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_application_object_path, TRUE, FALSE },
{ display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_window_object_path, TRUE, FALSE },
{ display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_app_menu_object_path, TRUE, FALSE },
{ display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_window_object_path, TRUE, FALSE },
{ display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_app_menu_object_path, TRUE, FALSE },
{ display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_menubar_object_path, TRUE, FALSE },
{ display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST,reload_gtk_frame_extents, TRUE, FALSE },
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
{ display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE },
{ display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE },

91
src/core/window.c

@ -44,6 +44,7 @@
#include "window-props.h"
#include "constraints.h"
#include "muffin-enum-types.h"
#include <clutter/clutter.h>
#include <X11/Xatom.h>
#include <X11/Xlibint.h> /* For display->resource_mask */
@ -55,6 +56,7 @@
#endif
#include <X11/XKBlib.h>
#include <X11/extensions/Xcomposite.h>
#include <gdk/gdkx.h>
static int destroying_windows_disallowed = 0;
@ -2069,12 +2071,12 @@ set_net_wm_state (MetaWindow *window)
data[i] = window->display->atom__NET_WM_STATE_SKIP_TASKBAR;
++i;
}
if (window->maximized_horizontally)
if (window->maximized_horizontally || window->tile_type != META_WINDOW_TILE_TYPE_NONE)
{
data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_HORZ;
++i;
}
if (window->maximized_vertically)
if (window->maximized_vertically || window->tile_type != META_WINDOW_TILE_TYPE_NONE)
{
data[i] = window->display->atom__NET_WM_STATE_MAXIMIZED_VERT;
++i;
@ -3401,7 +3403,8 @@ meta_window_hide (MetaWindow *window)
* focus the default window for the active workspace (this scenario
* arises when we are switching workspaces).
*/
if (my_workspace == window->screen->active_workspace)
if (window->type == META_WINDOW_MODAL_DIALOG &&
my_workspace == window->screen->active_workspace)
not_this_one = window;
meta_workspace_focus_default_window (window->screen->active_workspace,
@ -3592,7 +3595,7 @@ meta_topic (META_DEBUG_WINDOW_OPS,
meta_window_save_rect (window);
meta_window_set_tile_type (window, META_WINDOW_TILE_TYPE_NONE);
window->tile_mode = META_TILE_NONE;
window->tile_mode = META_TILE_MAXIMIZE;
notify_tile_type (window);
normalize_tile_state (window);
@ -3658,8 +3661,9 @@ meta_window_maximize (MetaWindow *window,
return;
}
if (window->tile_mode != META_TILE_NONE ||
window->last_tile_mode != META_TILE_NONE)
if ((window->tile_mode != META_TILE_NONE ||
window->last_tile_mode != META_TILE_NONE) &&
window->tile_mode != META_TILE_MAXIMIZE)
{
saved_rect = &window->saved_rect;
@ -3889,10 +3893,6 @@ meta_window_can_tile_side_by_side (MetaWindow *window)
monitor = meta_screen_get_current_monitor (window->screen);
meta_window_get_work_area_for_monitor (window, monitor->number, &tile_area);
/* Do not allow tiling in portrait orientation */
if (tile_area.height > tile_area.width)
return FALSE;
tile_area.width /= 2;
meta_frame_calc_borders (window->frame, &borders);
@ -3917,10 +3917,6 @@ meta_window_can_tile_top_bottom (MetaWindow *window)
monitor = meta_screen_get_current_monitor (window->screen);
meta_window_get_work_area_for_monitor (window, monitor->number, &tile_area);
/* Do not allow tiling in portrait orientation */
if (tile_area.height > tile_area.width)
return FALSE;
tile_area.height /= 2;
meta_frame_calc_borders (window->frame, &borders);
@ -4368,6 +4364,37 @@ meta_window_unshade (MetaWindow *window,
}
}
#define OPACITY_STEP 32
LOCAL_SYMBOL void
meta_window_adjust_opacity (MetaWindow *window,
gboolean increase)
{
ClutterActor *actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
gint current_opacity, new_opacity;
current_opacity = clutter_actor_get_opacity (actor);
if (increase) {
new_opacity = MIN (current_opacity + OPACITY_STEP, 255);
} else {
new_opacity = MAX (current_opacity - OPACITY_STEP, 0);
}
if (new_opacity != current_opacity) {
clutter_actor_set_opacity (actor, (guint8) new_opacity);
}
}
void
meta_window_reset_opacity (MetaWindow *window)
{
ClutterActor *actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
clutter_actor_set_opacity (actor, 255);
}
static gboolean
unminimize_func (MetaWindow *window,
void *data)
@ -5742,7 +5769,18 @@ meta_window_get_outer_rect (const MetaWindow *window,
rect->height -= borders.invisible.top + borders.invisible.bottom;
}
else
*rect = window->rect;
{
*rect = window->rect;
if (window->has_custom_frame_extents)
{
const GtkBorder *extents = &window->custom_frame_extents;
rect->x += extents->left;
rect->y += extents->top;
rect->width -= extents->left + extents->right;
rect->height -= extents->top + extents->bottom;
}
}
}
MetaSide
@ -9055,12 +9093,15 @@ update_move (MetaWindow *window,
y,
meta_prefs_get_tile_hud_threshold ());
int scale;
scale = CLAMP ((int)(clutter_backend_get_resolution (clutter_get_default_backend ()) / 96.0), 1, 4);
guint edge_zone = meta_window_get_current_zone (window,
monitor->rect,
work_area,
x,
y,
HUD_WIDTH);
HUD_WIDTH * scale);
switch (edge_zone) {
case ZONE_0:
@ -10195,6 +10236,24 @@ meta_window_same_client (MetaWindow *window,
(other_window->xwindow & ~resource_mask));
}
/**
* meta_window_is_client_decorated:
*
* Check if if the window has decorations drawn by the client.
* (window->decorated refers only to whether we should add decorations)
*/
gboolean
meta_window_is_client_decorated (MetaWindow *window)
{
/* Currently the implementation here is hackish -
* has_custom_frame_extents() is set if _GTK_FRAME_EXTENTS is set
* to any value even 0. GTK+ always sets _GTK_FRAME_EXTENTS for
* client-side-decorated window, even if the value is 0 because
* the window is maxized and has no invisible borders or shadows.
*/
return window->has_custom_frame_extents;
}
LOCAL_SYMBOL void
meta_window_refresh_resize_popup (MetaWindow *window)
{

3
src/core/workspace.c

@ -194,7 +194,7 @@ meta_workspace_new (MetaScreen *screen)
return workspace;
}
/** Foreach function for workspace_free_struts() */
/* Foreach function for workspace_free_struts() */
static void
free_this (gpointer candidate, gpointer dummy)
{
@ -1390,4 +1390,3 @@ meta_workspace_get_screen (MetaWorkspace *workspace)
{
return workspace->screen;
}

1
src/meta/atomnames.h

@ -65,6 +65,7 @@ item(_GTK_APPLICATION_OBJECT_PATH)
item(_GTK_WINDOW_OBJECT_PATH)
item(_GTK_APP_MENU_OBJECT_PATH)
item(_GTK_MENUBAR_OBJECT_PATH)
item(_GTK_FRAME_EXTENTS)
item(_GNOME_WM_KEYBINDINGS)
item(_GNOME_PANEL_ACTION)
item(_GNOME_PANEL_ACTION_MAIN_MENU)

12
src/meta/prefs.h

@ -43,6 +43,7 @@ typedef enum
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
META_PREF_ACTION_SCROLL_WHEEL_TITLEBAR,
META_PREF_AUTO_RAISE,
META_PREF_AUTO_RAISE_DELAY,
META_PREF_THEME,
@ -126,6 +127,7 @@ void meta_prefs_get_button_layout (MetaButtonLayout *butt
CDesktopTitlebarAction meta_prefs_get_action_double_click_titlebar (void);
CDesktopTitlebarAction meta_prefs_get_action_middle_click_titlebar (void);
CDesktopTitlebarAction meta_prefs_get_action_right_click_titlebar (void);
CDesktopTitlebarScrollAction meta_prefs_get_action_scroll_wheel_titlebar (void);
void meta_prefs_set_num_workspaces (int n_workspaces);
@ -261,6 +263,8 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_MOVE_TO_SIDE_E,
META_KEYBINDING_ACTION_MOVE_TO_SIDE_W,
META_KEYBINDING_ACTION_MOVE_TO_CENTER,
META_KEYBINDING_ACTION_INCREASE_OPACITY,
META_KEYBINDING_ACTION_DECREASE_OPACITY,
META_KEYBINDING_ACTION_CUSTOM,
META_KEYBINDING_ACTION_LAST
@ -310,13 +314,13 @@ typedef struct
*/
GSList *bindings;
/** for keybindings that can have shift or not like Alt+Tab */
/* for keybindings that can have shift or not like Alt+Tab */
gboolean add_shift:1;
/** for keybindings that apply only to a window */
/* for keybindings that apply only to a window */
gboolean per_window:1;
/** for keybindings not added with meta_display_add_keybinding() */
/* for keybindings not added with meta_display_add_keybinding() */
gboolean builtin:1;
} MetaKeyPref;
@ -339,5 +343,3 @@ CDesktopVisualBellType meta_prefs_get_visual_bell_type (void);
MetaPlacementMode meta_prefs_get_placement_mode (void);
#endif

1
src/meta/window.h

@ -162,6 +162,7 @@ void meta_window_minimize (MetaWindow *window);
void meta_window_unminimize (MetaWindow *window);
void meta_window_raise (MetaWindow *window);
void meta_window_lower (MetaWindow *window);
void meta_window_reset_opacity (MetaWindow *window);
const char *meta_window_get_title (MetaWindow *window);
MetaWindow *meta_window_get_transient_for (MetaWindow *window);
Window meta_window_get_transient_for_as_xid (MetaWindow *window);

11
src/org.cinnamon.muffin.gschema.xml.in

@ -99,7 +99,7 @@
</key>
<key name="tile-hud-threshold" type="i">
<default>150</default>
<default>35</default>
<range min="1" max="400"/>
<_summary>Window tile HUD threshold</_summary>
<_description>
@ -520,6 +520,15 @@
<default>[]</default>
<_summary>Move window to center of screen</_summary>
</key>
<key name="increase-opacity" type="as">
<default>[]</default>
<_summary>Increase the opacity of the current window</_summary>
</key>
<key name="decrease-opacity" type="as">
<default>[]</default>
<_summary>Decrease the opacity of the current window</_summary>
</key>
</schema>
</schemalist>

88
src/ui/frames.c

@ -338,8 +338,10 @@ meta_frames_finalize (GObject *object)
g_hash_table_destroy (frames->text_heights);
invalidate_all_caches (frames);
if (frames->invalidate_cache_timeout_id)
if (frames->invalidate_cache_timeout_id) {
g_source_remove (frames->invalidate_cache_timeout_id);
frames->invalidate_cache_timeout_id = 0;
}
g_assert (g_hash_table_size (frames->frames) == 0);
g_hash_table_destroy (frames->frames);
@ -1134,6 +1136,12 @@ redraw_control (MetaFrames *frames,
invalidate_cache (frames, frame);
}
enum
{
MOUSEWHEEL_UP = 4,
MOUSEWHEEL_DOWN = 5
};
static gboolean
meta_frame_titlebar_event (MetaUIFrame *frame,
GdkEventButton *event,
@ -1236,6 +1244,48 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
event->button,
event->time);
break;
/* These last 3 are CDesktopTitlebarScrollAction but
since we're working with ints, it doesn't matter */
case C_DESKTOP_TITLEBAR_SCROLL_ACTION_SHADE:
{
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
META_CORE_GET_END);
if (flags & META_FRAME_ALLOWS_SHADE)
{
if (event->button == MOUSEWHEEL_DOWN &&
flags & META_FRAME_SHADED)
meta_core_unshade (display,
frame->xwindow,
event->time);
else if (event->button == MOUSEWHEEL_UP &&
flags & ~META_FRAME_SHADED)
meta_core_shade (display,
frame->xwindow,
event->time);
}
}
break;
case C_DESKTOP_TITLEBAR_SCROLL_ACTION_OPACITY:
{
if (event->button == MOUSEWHEEL_UP) {
meta_core_adjust_opacity (display,
frame->xwindow,
TRUE); /* TRUE = increase */
} else {
meta_core_adjust_opacity (display,
frame->xwindow,
FALSE); /* decrease */
}
}
break;
case C_DESKTOP_TITLEBAR_SCROLL_ACTION_NONE:
break;
}
return TRUE;
@ -1268,6 +1318,15 @@ meta_frame_right_click_event(MetaUIFrame *frame,
return meta_frame_titlebar_event (frame, event, action);
}
static gboolean
meta_frame_scroll_wheel_event (MetaUIFrame *frame,
GdkEventButton *event)
{
int action = meta_prefs_get_action_scroll_wheel_titlebar();
return meta_frame_titlebar_event (frame, event, action);
}
static gboolean
meta_frame_double_click_edge_event (MetaUIFrame *frame,
GdkEventButton *event,
@ -1529,6 +1588,11 @@ meta_frames_button_press_event (GtkWidget *widget,
event->y_root);
}
}
else if (control == META_FRAME_CONTROL_TITLE &&
(event->button == 4 || event->button == 5))
{
return meta_frame_scroll_wheel_event (frame, event);
}
else if (event->button == 2)
{
return meta_frame_middle_click_event (frame, event);
@ -2055,8 +2119,10 @@ populate_cache (MetaFrames *frames,
piece->pixmap = generate_pixmap (frames, frame, &piece->rect);
}
if (frames->invalidate_cache_timeout_id)
if (frames->invalidate_cache_timeout_id) {
g_source_remove (frames->invalidate_cache_timeout_id);
frames->invalidate_cache_timeout_id = 0;
}
frames->invalidate_cache_timeout_id = g_timeout_add (1000, invalidate_cache_timeout, frames);
@ -2506,6 +2572,8 @@ control_rect (MetaFrameControl control,
}
#define TOP_RESIZE_HEIGHT 4
#define CORNER_SIZE_MULT 2
static MetaFrameControl
get_control (MetaFrames *frames,
MetaUIFrame *frame,
@ -2597,8 +2665,8 @@ get_control (MetaFrames *frames,
* in case of overlap.
*/
if (y >= (fgeom.height - fgeom.borders.total.bottom) &&
x >= (fgeom.width - fgeom.borders.total.right))
if (y >= (fgeom.height - fgeom.borders.total.bottom * CORNER_SIZE_MULT) &&
x >= (fgeom.width - fgeom.borders.total.right * CORNER_SIZE_MULT))
{
if ((has_vert && has_horiz) || (has_bottom && has_right))
return META_FRAME_CONTROL_RESIZE_SE;
@ -2607,8 +2675,8 @@ get_control (MetaFrames *frames,
else if (has_right)
return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.borders.total.bottom) &&
x <= fgeom.borders.total.left)
else if (y >= (fgeom.height - fgeom.borders.total.bottom * CORNER_SIZE_MULT) &&
x <= fgeom.borders.total.left * CORNER_SIZE_MULT)
{
if ((has_vert && has_horiz) || (has_bottom && has_left))
return META_FRAME_CONTROL_RESIZE_SW;
@ -2617,8 +2685,8 @@ get_control (MetaFrames *frames,
else if (has_left)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.borders.invisible.top) &&
x <= fgeom.borders.total.left && has_north_resize)
else if (y < (fgeom.borders.invisible.top * CORNER_SIZE_MULT) &&
(x <= fgeom.borders.total.left * CORNER_SIZE_MULT) && has_north_resize)
{
if ((has_vert && has_horiz) || (has_top && has_left))
return META_FRAME_CONTROL_RESIZE_NW;
@ -2627,8 +2695,8 @@ get_control (MetaFrames *frames,
else if (has_left)
return META_FRAME_CONTROL_RESIZE_W;
}
else if (y < (fgeom.borders.invisible.top) &&
x >= fgeom.width - fgeom.borders.total.right && has_north_resize)
else if (y < (fgeom.borders.invisible.top * CORNER_SIZE_MULT) &&
x >= (fgeom.width - fgeom.borders.total.right * CORNER_SIZE_MULT) && has_north_resize)
{
if ((has_vert && has_horiz) || (has_top && has_right))
return META_FRAME_CONTROL_RESIZE_NE;

4
src/ui/theme-parser.c

@ -26,6 +26,7 @@
#include <meta/util.h>
#include <string.h>
#include <stdlib.h>
#include <clutter/clutter.h>
/* We were intending to put the version number
* in the subdirectory name, but we ended up
@ -625,7 +626,7 @@ parse_positive_integer (const char *str,
return FALSE;
}
*val = (int) l;
*val = (int) l * theme->scale;
return TRUE;
}
@ -3580,6 +3581,7 @@ start_element_handler (GMarkupParseContext *context,
info->theme->filename = g_strdup (info->theme_file);
info->theme->dirname = g_strdup (info->theme_dir);
info->theme->format_version = info->format_version;
info->theme->scale = CLAMP ((int)(clutter_backend_get_resolution (clutter_get_default_backend ()) / 96.0), 1, 4);
push_state (info, STATE_THEME);
}

2
src/ui/theme-private.h

@ -867,6 +867,8 @@ struct _MetaTheme
*/
guint format_version;
guint scale;
/** Symbol table of integer constants. */
GHashTable *integer_constants;
/** Symbol table of float constants. */

20
src/ui/tile-hud.c

@ -30,6 +30,7 @@
#include "display-private.h"
#include "window-private.h"
#include "boxes-private.h"
#include <clutter/clutter.h>
#include <math.h>
#include "core.h"
@ -263,18 +264,21 @@ meta_tile_hud_draw (GtkWidget *widget,
cairo_paint (cr);
MetaRectangle tile_area;
int width;
width = HUD_WIDTH * CLAMP ((int)(clutter_backend_get_resolution (clutter_get_default_backend ()) / 96.0), 1, 4);
if (hud->restrictions & HUD_CAN_TILE_SIDE_BY_SIDE)
{
// LEFT
if (hud->current_proximity_zone == ZONE_2) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LEFT, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LEFT, &tile_area, width);
tile_area.y += OFFSET;
tile_area.height -= 2 * OFFSET;
do_side_box (hud, cr, LEFT, tile_area);
}
// RIGHT
if (hud->current_proximity_zone == ZONE_3) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_RIGHT, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_RIGHT, &tile_area, width);
tile_area.y += OFFSET;
tile_area.height -= 2 * OFFSET;
do_side_box (hud, cr, RIGHT, tile_area);
@ -284,36 +288,36 @@ meta_tile_hud_draw (GtkWidget *widget,
if (hud->restrictions & HUD_CAN_TILE_CORNER) {
// ULC
if (hud->current_proximity_zone == ZONE_4) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_ULC, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_ULC, &tile_area, width);
do_corner_box (hud, cr, LEFT | TOP, tile_area);
}
// LLC
if (hud->current_proximity_zone == ZONE_7) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LLC, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LLC, &tile_area, width);
do_corner_box (hud, cr, LEFT | BOTTOM, tile_area);
}
// URC
if (hud->current_proximity_zone == ZONE_5) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_URC, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_URC, &tile_area, width);
do_corner_box (hud, cr, RIGHT | TOP, tile_area);
}
// LRC
if (hud->current_proximity_zone == ZONE_6) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LRC, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_LRC, &tile_area, width);
do_corner_box (hud, cr, RIGHT | BOTTOM, tile_area);
}
}
if (hud->restrictions & HUD_CAN_TILE_TOP_BOTTOM) {
// TOP
if (hud->current_proximity_zone == ZONE_0) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_TOP, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_TOP, &tile_area, width);
tile_area.x += OFFSET;
tile_area.width -= 2 * OFFSET;
do_side_box (hud, cr, TOP, tile_area);
}
// BOTTOM
if (hud->current_proximity_zone == ZONE_1) {
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_BOTTOM, &tile_area, HUD_WIDTH);
meta_window_get_tile_threshold_area_for_mode (NULL, hud->relative_work_area, META_TILE_BOTTOM, &tile_area, width);
tile_area.x += OFFSET;
tile_area.width -= 2 * OFFSET;
do_side_box (hud, cr, BOTTOM, tile_area);

5
src/ui/ui.c

@ -73,6 +73,11 @@ meta_ui_init (void)
if (!gtk_init_check (NULL, NULL))
meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));
/* We need to be able to fully trust that the window and monitor sizes
+ that Gdk reports corresponds to the X ones, so we disable the automatic
+ scale handling */
gdk_x11_display_set_window_scale (gdk_display_get_default (), 1);
meta_stock_icons_init ();
}

Loading…
Cancel
Save