Annotation of /trunk/metacity/patches/metacity-2-logout.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 7363 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 7363 byte(s)
-import
1 | niro | 153 | diff -ur metacity-2.8.6/src/keybindings.c metacity-2.8.6-patched/src/keybindings.c |
2 | --- metacity-2.8.6/src/keybindings.c 2004-10-11 23:42:37.000000000 +0800 | ||
3 | +++ metacity-2.8.6-patched/src/keybindings.c 2004-12-08 11:50:25.631274776 +0800 | ||
4 | @@ -30,6 +30,7 @@ | ||
5 | #include "place.h" | ||
6 | #include "prefs.h" | ||
7 | #include "effects.h" | ||
8 | +#include "session.h" | ||
9 | |||
10 | #include <X11/keysym.h> | ||
11 | #include <string.h> | ||
12 | @@ -84,6 +85,11 @@ | ||
13 | MetaWindow *window, | ||
14 | XEvent *event, | ||
15 | MetaKeyBinding *binding); | ||
16 | +static void handle_logout (MetaDisplay *display, | ||
17 | + MetaScreen *screen, | ||
18 | + MetaWindow *window, | ||
19 | + XEvent *event, | ||
20 | + MetaKeyBinding *binding); | ||
21 | static void handle_panel_keybinding (MetaDisplay *display, | ||
22 | MetaScreen *screen, | ||
23 | MetaWindow *window, | ||
24 | @@ -285,6 +291,8 @@ | ||
25 | GINT_TO_POINTER (META_TAB_LIST_DOCKS) }, | ||
26 | { META_KEYBINDING_SHOW_DESKTOP, handle_toggle_desktop, | ||
27 | NULL }, | ||
28 | + { META_KEYBINDING_LOGOUT, handle_logout, | ||
29 | + NULL }, | ||
30 | { META_KEYBINDING_PANEL_MAIN_MENU, handle_panel_keybinding, | ||
31 | GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_MAIN_MENU) }, | ||
32 | { META_KEYBINDING_PANEL_RUN_DIALOG, handle_panel_keybinding, | ||
33 | @@ -2785,6 +2793,16 @@ | ||
34 | } | ||
35 | |||
36 | static void | ||
37 | +handle_logout (MetaDisplay *display, | ||
38 | + MetaScreen *screen, | ||
39 | + MetaWindow *window, | ||
40 | + XEvent *event, | ||
41 | + MetaKeyBinding *binding) | ||
42 | +{ | ||
43 | + meta_session_request_logout (); | ||
44 | +} | ||
45 | + | ||
46 | +static void | ||
47 | handle_panel_keybinding (MetaDisplay *display, | ||
48 | MetaScreen *screen, | ||
49 | MetaWindow *window, | ||
50 | diff -ur metacity-2.8.6/src/metacity.schemas metacity-2.8.6-patched/src/metacity.schemas | ||
51 | --- metacity-2.8.6/src/metacity.schemas 2004-10-04 01:25:40.000000000 +0800 | ||
52 | +++ metacity-2.8.6-patched/src/metacity.schemas 2004-12-08 11:50:25.652271584 +0800 | ||
53 | @@ -22578,6 +22578,29 @@ | ||
54 | </locale> | ||
55 | </schema> | ||
56 | |||
57 | + <schema> | ||
58 | + <key>/schemas/apps/metacity/global_keybindings/logout</key> | ||
59 | + <applyto>/apps/metacity/global_keybindings/logout</applyto> | ||
60 | + <owner>metacity</owner> | ||
61 | + <type>string</type> | ||
62 | + <default><Control><Alt>Delete</default> | ||
63 | + <locale name="C"> | ||
64 | + <short>Log out</short> | ||
65 | + <long> | ||
66 | + The keybinding that logs you out from the session. | ||
67 | + | ||
68 | + The format looks like "<Control><Alt>Delete" or | ||
69 | + "<Shift><Alt>F1. | ||
70 | + | ||
71 | + The parser is fairly liberal and allows lower or upper case, | ||
72 | + and also abbreviations such as "<Ctl>" and | ||
73 | + "<Ctrl>". If you set the option to the special string | ||
74 | + "disabled", then there will be no keybinding for this | ||
75 | + action. | ||
76 | + </long> | ||
77 | + </locale> | ||
78 | + </schema> | ||
79 | + | ||
80 | <schema> | ||
81 | <key>/schemas/apps/metacity/global_keybindings/panel_main_menu</key> | ||
82 | <applyto>/apps/metacity/global_keybindings/panel_main_menu</applyto> | ||
83 | diff -ur metacity-2.8.6/src/metacity.schemas.in metacity-2.8.6-patched/src/metacity.schemas.in | ||
84 | --- metacity-2.8.6/src/metacity.schemas.in 2004-07-25 00:28:14.000000000 +0800 | ||
85 | +++ metacity-2.8.6-patched/src/metacity.schemas.in 2004-12-08 11:50:25.654271280 +0800 | ||
86 | @@ -1641,6 +1641,29 @@ | ||
87 | </locale> | ||
88 | </schema> | ||
89 | |||
90 | + <schema> | ||
91 | + <key>/schemas/apps/metacity/global_keybindings/logout</key> | ||
92 | + <applyto>/apps/metacity/global_keybindings/logout</applyto> | ||
93 | + <owner>metacity</owner> | ||
94 | + <type>string</type> | ||
95 | + <default><Control><Alt>Delete</default> | ||
96 | + <locale name="C"> | ||
97 | + <short>Log out</short> | ||
98 | + <long> | ||
99 | + The keybinding that logs you out from the session. | ||
100 | + | ||
101 | + The format looks like "<Control><Alt>Delete" or | ||
102 | + "<Shift><Alt>F1. | ||
103 | + | ||
104 | + The parser is fairly liberal and allows lower or upper case, | ||
105 | + and also abbreviations such as "<Ctl>" and | ||
106 | + "<Ctrl>". If you set the option to the special string | ||
107 | + "disabled", then there will be no keybinding for this | ||
108 | + action. | ||
109 | + </long> | ||
110 | + </locale> | ||
111 | + </schema> | ||
112 | + | ||
113 | <schema> | ||
114 | <key>/schemas/apps/metacity/global_keybindings/panel_main_menu</key> | ||
115 | <applyto>/apps/metacity/global_keybindings/panel_main_menu</applyto> | ||
116 | diff -ur metacity-2.8.6/src/prefs.c metacity-2.8.6-patched/src/prefs.c | ||
117 | --- metacity-2.8.6/src/prefs.c 2004-09-18 23:54:31.000000000 +0800 | ||
118 | +++ metacity-2.8.6-patched/src/prefs.c 2004-12-08 11:50:25.655271128 +0800 | ||
119 | @@ -1421,6 +1421,7 @@ | ||
120 | { META_KEYBINDING_CYCLE_PANELS, 0, 0, TRUE }, | ||
121 | { META_KEYBINDING_CYCLE_PANELS_BACKWARD, 0, 0, TRUE }, | ||
122 | { META_KEYBINDING_SHOW_DESKTOP, 0, 0, FALSE }, | ||
123 | + { META_KEYBINDING_LOGOUT, 0, 0, FALSE }, | ||
124 | { META_KEYBINDING_PANEL_MAIN_MENU, 0, 0, FALSE }, | ||
125 | { META_KEYBINDING_PANEL_RUN_DIALOG, 0, 0, FALSE }, | ||
126 | { META_KEYBINDING_COMMAND_1, 0, 0, FALSE }, | ||
127 | diff -ur metacity-2.8.6/src/prefs.h metacity-2.8.6-patched/src/prefs.h | ||
128 | --- metacity-2.8.6/src/prefs.h 2004-02-20 02:36:14.000000000 +0800 | ||
129 | +++ metacity-2.8.6-patched/src/prefs.h 2004-12-08 11:52:59.051951288 +0800 | ||
130 | @@ -111,6 +111,7 @@ | ||
131 | #define META_KEYBINDING_CYCLE_PANELS "cycle_panels" | ||
132 | #define META_KEYBINDING_CYCLE_PANELS_BACKWARD "cycle_panels_backward" | ||
133 | #define META_KEYBINDING_SHOW_DESKTOP "show_desktop" | ||
134 | +#define META_KEYBINDING_LOGOUT "logout" | ||
135 | #define META_KEYBINDING_PANEL_MAIN_MENU "panel_main_menu" | ||
136 | #define META_KEYBINDING_PANEL_RUN_DIALOG "panel_run_dialog" | ||
137 | #define META_KEYBINDING_COMMAND_1 "run_command_1" | ||
138 | @@ -211,6 +212,7 @@ | ||
139 | META_KEYBINDING_ACTION_CYCLE_PANELS, | ||
140 | META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD, | ||
141 | META_KEYBINDING_ACTION_SHOW_DESKTOP, | ||
142 | + META_KEYBINDING_ACTION_LOGOUT, | ||
143 | META_KEYBINDING_ACTION_PANEL_MAIN_MENU, | ||
144 | META_KEYBINDING_ACTION_PANEL_RUN_DIALOG, | ||
145 | META_KEYBINDING_ACTION_COMMAND_1, | ||
146 | diff -ur metacity-2.8.6/src/session.c metacity-2.8.6-patched/src/session.c | ||
147 | --- metacity-2.8.6/src/session.c 2004-08-30 14:14:25.000000000 +0800 | ||
148 | +++ metacity-2.8.6-patched/src/session.c 2004-12-08 11:50:25.656270976 +0800 | ||
149 | @@ -357,6 +357,24 @@ | ||
150 | g_free (saved_client_id); | ||
151 | } | ||
152 | |||
153 | +/** | ||
154 | + * meta_session_request_logout: | ||
155 | + * | ||
156 | + * Requests that a save_yourself be sent to the session manager so that we log | ||
157 | + * out. | ||
158 | + **/ | ||
159 | +void | ||
160 | +meta_session_request_logout (void) | ||
161 | +{ | ||
162 | + if (!session_connection) | ||
163 | + { | ||
164 | + meta_warning (_("Cannot log out because we could not connect to the session manager\n")); | ||
165 | + return; | ||
166 | + } | ||
167 | + | ||
168 | + SmcRequestSaveYourself (session_connection, SmSaveGlobal, TRUE, SmInteractStyleAny, FALSE, TRUE); | ||
169 | +} | ||
170 | + | ||
171 | void | ||
172 | meta_session_shutdown (void) | ||
173 | { | ||
174 | diff -ur metacity-2.8.6/src/session.h metacity-2.8.6-patched/src/session.h | ||
175 | --- metacity-2.8.6/src/session.h 2002-09-04 10:44:52.000000000 +0800 | ||
176 | +++ metacity-2.8.6-patched/src/session.h 2004-12-08 11:50:25.657270824 +0800 | ||
177 | @@ -72,7 +72,7 @@ | ||
178 | void meta_session_init (const char *client_id, | ||
179 | const char *save_file); | ||
180 | |||
181 | - | ||
182 | +void meta_session_request_logout (void); | ||
183 | void meta_session_shutdown (void); | ||
184 | |||
185 | #endif |