add "what happens when you double click the titlebar" setting, patch from
2002-10-18 Havoc Pennington <hp@redhat.com> * src/prefs.c, src/frames.c: add "what happens when you double click the titlebar" setting, patch from Sean Middleditch bug #95625. This is basically an "add Windows emulation mode" patch.
This commit is contained in:
parent
6e90c238e8
commit
1094410ff8
@ -1,3 +1,9 @@
|
||||
2002-10-18 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* src/prefs.c, src/frames.c: add "what happens when you double
|
||||
click the titlebar" setting, patch from Sean Middleditch bug
|
||||
#95625. This is basically an "add Windows emulation mode" patch.
|
||||
|
||||
2002-10-18 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* src/metacity.schemas.in: move window-click to Super+click not
|
||||
|
@ -140,6 +140,13 @@ typedef enum
|
||||
META_FOCUS_MODE_MOUSE
|
||||
} MetaFocusMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE,
|
||||
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE,
|
||||
META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST
|
||||
} MetaActionDoubleClickTitlebar;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_FRAME_TYPE_NORMAL,
|
||||
|
19
src/core.c
19
src/core.c
@ -322,6 +322,25 @@ meta_core_maximize (Display *xdisplay,
|
||||
meta_window_maximize (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_toggle_maximize (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaWindow *window;
|
||||
|
||||
display = meta_display_for_x_display (xdisplay);
|
||||
window = meta_display_lookup_x_window (display, frame_xwindow);
|
||||
|
||||
if (window == NULL || window->frame == NULL)
|
||||
meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
|
||||
|
||||
if (window->maximized)
|
||||
meta_window_unmaximize (window);
|
||||
else
|
||||
meta_window_maximize (window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_unmaximize (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
|
@ -77,6 +77,8 @@ void meta_core_get_size (Display *xdisplay,
|
||||
|
||||
void meta_core_minimize (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_toggle_maximize (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_unmaximize (Display *xdisplay,
|
||||
Window frame_xwindow);
|
||||
void meta_core_maximize (Display *xdisplay,
|
||||
|
43
src/frames.c
43
src/frames.c
@ -1068,18 +1068,41 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
{
|
||||
MetaFrameFlags flags;
|
||||
|
||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
||||
|
||||
if (flags & META_FRAME_ALLOWS_SHADE)
|
||||
switch (meta_prefs_get_action_double_click_titlebar ())
|
||||
{
|
||||
if (flags & META_FRAME_SHADED)
|
||||
meta_core_unshade (gdk_display,
|
||||
frame->xwindow);
|
||||
else
|
||||
meta_core_shade (gdk_display,
|
||||
frame->xwindow);
|
||||
}
|
||||
case META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE:
|
||||
{
|
||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
||||
|
||||
if (flags & META_FRAME_ALLOWS_SHADE)
|
||||
{
|
||||
if (flags & META_FRAME_SHADED)
|
||||
meta_core_unshade (gdk_display,
|
||||
frame->xwindow);
|
||||
else
|
||||
meta_core_shade (gdk_display,
|
||||
frame->xwindow);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE:
|
||||
{
|
||||
MetaFrameFlags flags;
|
||||
|
||||
flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
|
||||
|
||||
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
||||
{
|
||||
meta_core_toggle_maximize (gdk_display, frame->xwindow);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,23 @@
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/metacity/general/action_double_click_titlebar</key>
|
||||
<applyto>/apps/metacity/general/action_double_click_titlebar</applyto>
|
||||
<owner>metacity</owner>
|
||||
<type>string</type>
|
||||
<default>toggle_shade</default>
|
||||
<locale name="C">
|
||||
<short>Action on title bar double-click</short>
|
||||
<long>
|
||||
This option determines the effects of double-clicking on the
|
||||
title bar. Current valid options are 'toggle_shade', which will
|
||||
shade/unshade the window, and 'toggle_maximize' which will
|
||||
maximize/unmaximize the window.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/metacity/general/auto_raise</key>
|
||||
<applyto>/apps/metacity/general/auto_raise</applyto>
|
||||
|
67
src/prefs.c
67
src/prefs.c
@ -32,6 +32,7 @@
|
||||
*/
|
||||
#define KEY_MOUSE_BUTTON_MODS "/apps/metacity/general/mouse_button_modifier"
|
||||
#define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
|
||||
#define KEY_ACTION_DOUBLE_CLICK_TITLEBAR "/apps/metacity/general/action_double_click_titlebar"
|
||||
#define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
|
||||
#define KEY_AUTO_RAISE_DELAY "/apps/metacity/general/auto_raise_delay"
|
||||
#define KEY_THEME "/apps/metacity/general/theme"
|
||||
@ -56,6 +57,8 @@ static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
||||
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
|
||||
static char* current_theme = NULL;
|
||||
static int num_workspaces = 4;
|
||||
static MetaActionDoubleClickTitlebar action_double_click_titlebar =
|
||||
META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE;
|
||||
static gboolean application_based = FALSE;
|
||||
static gboolean disable_workarounds = FALSE;
|
||||
static gboolean auto_raise = FALSE;
|
||||
@ -87,6 +90,7 @@ static gboolean update_theme (const char *value);
|
||||
static gboolean update_num_workspaces (int value);
|
||||
static gboolean update_application_based (gboolean value);
|
||||
static gboolean update_disable_workarounds (gboolean value);
|
||||
static gboolean update_action_double_click_titlebar (const char *value);
|
||||
static gboolean update_auto_raise (gboolean value);
|
||||
static gboolean update_auto_raise_delay (int value);
|
||||
static gboolean update_button_layout (const char *value);
|
||||
@ -268,6 +272,13 @@ meta_prefs_init (void)
|
||||
update_focus_mode (str_val);
|
||||
g_free (str_val);
|
||||
|
||||
str_val = gconf_client_get_string (default_client,
|
||||
KEY_ACTION_DOUBLE_CLICK_TITLEBAR,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
update_action_double_click_titlebar (str_val);
|
||||
g_free (str_val);
|
||||
|
||||
bool_val = gconf_client_get_bool (default_client, KEY_AUTO_RAISE,
|
||||
&err);
|
||||
cleanup_error (&err);
|
||||
@ -533,6 +544,22 @@ change_notify (GConfClient *client,
|
||||
if (update_screen_binding (key, str))
|
||||
queue_changed (META_PREF_SCREEN_KEYBINDINGS);
|
||||
}
|
||||
else if (strcmp (key, KEY_ACTION_DOUBLE_CLICK_TITLEBAR) == 0)
|
||||
{
|
||||
const char *str;
|
||||
|
||||
if (value && value->type != GCONF_VALUE_STRING)
|
||||
{
|
||||
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
||||
key);
|
||||
goto out;
|
||||
}
|
||||
|
||||
str = value ? gconf_value_get_string (value) : NULL;
|
||||
|
||||
if (update_action_double_click_titlebar (str))
|
||||
queue_changed (META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR);
|
||||
}
|
||||
else if (strcmp (key, KEY_AUTO_RAISE) == 0)
|
||||
{
|
||||
gboolean b;
|
||||
@ -977,6 +1004,37 @@ meta_prefs_get_disable_workarounds (void)
|
||||
return disable_workarounds;
|
||||
}
|
||||
|
||||
static MetaActionDoubleClickTitlebar
|
||||
action_double_click_titlebar_from_string (const char *str)
|
||||
{
|
||||
if (strcmp (str, "toggle_shade") == 0)
|
||||
return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_SHADE;
|
||||
else if (strcmp (str, "toggle_maximize") == 0)
|
||||
return META_ACTION_DOUBLE_CLICK_TITLEBAR_TOGGLE_MAXIMIZE;
|
||||
else
|
||||
return META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_action_double_click_titlebar (const char *value)
|
||||
{
|
||||
MetaActionDoubleClickTitlebar old_action = action_double_click_titlebar;
|
||||
|
||||
if (value != NULL)
|
||||
{
|
||||
action_double_click_titlebar = action_double_click_titlebar_from_string (value);
|
||||
|
||||
if (action_double_click_titlebar == META_ACTION_DOUBLE_CLICK_TITLEBAR_LAST)
|
||||
{
|
||||
action_double_click_titlebar = old_action;
|
||||
meta_warning (_("GConf key '%s' is set to an invalid value\n"),
|
||||
KEY_ACTION_DOUBLE_CLICK_TITLEBAR);
|
||||
}
|
||||
}
|
||||
|
||||
return (old_action != action_double_click_titlebar);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_auto_raise (gboolean value)
|
||||
{
|
||||
@ -1039,6 +1097,9 @@ meta_preference_to_string (MetaPreference pref)
|
||||
case META_PREF_DISABLE_WORKAROUNDS:
|
||||
return "DISABLE_WORKAROUNDS";
|
||||
|
||||
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
||||
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
||||
|
||||
case META_PREF_AUTO_RAISE:
|
||||
return "AUTO_RAISE";
|
||||
|
||||
@ -1417,6 +1478,12 @@ meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
|
||||
*n_bindings = (int) G_N_ELEMENTS (window_bindings) - 1;
|
||||
}
|
||||
|
||||
MetaActionDoubleClickTitlebar
|
||||
meta_prefs_get_action_double_click_titlebar ()
|
||||
{
|
||||
return action_double_click_titlebar;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_prefs_get_auto_raise ()
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ typedef enum
|
||||
{
|
||||
META_PREF_MOUSE_BUTTON_MODS,
|
||||
META_PREF_FOCUS_MODE,
|
||||
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
||||
META_PREF_AUTO_RAISE,
|
||||
META_PREF_AUTO_RAISE_DELAY,
|
||||
META_PREF_THEME,
|
||||
@ -70,6 +71,7 @@ const char* meta_prefs_get_command (int i);
|
||||
char* meta_prefs_get_gconf_key_for_command (int i);
|
||||
|
||||
void meta_prefs_get_button_layout (MetaButtonLayout *button_layout);
|
||||
MetaActionDoubleClickTitlebar meta_prefs_get_action_double_click_titlebar (void);
|
||||
|
||||
void meta_prefs_set_num_workspaces (int n_workspaces);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user