~ubuntu-branches/debian/jessie/gnome-shell/jessie

« back to all changes in this revision

Viewing changes to src/shell-wm.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-05-30 13:19:38 UTC
  • mfrom: (18.1.24 experimental)
  • Revision ID: package-import@ubuntu.com-20120530131938-i3trc1g1p3is2u6x
Tags: 3.4.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
#include "shell-wm-private.h"
10
10
#include "shell-global.h"
11
 
#include "shell-marshal.h"
12
11
 
13
12
struct _ShellWM {
14
13
  GObject parent;
28
27
  KILL_SWITCH_WORKSPACE,
29
28
  KILL_WINDOW_EFFECTS,
30
29
 
31
 
  KEYBINDING,
32
 
 
33
30
  LAST_SIGNAL
34
31
};
35
32
 
60
57
                  G_TYPE_FROM_CLASS (klass),
61
58
                  G_SIGNAL_RUN_LAST,
62
59
                  0,
63
 
                  NULL, NULL,
64
 
                  g_cclosure_marshal_VOID__OBJECT,
 
60
                  NULL, NULL, NULL,
65
61
                  G_TYPE_NONE, 1,
66
62
                  META_TYPE_WINDOW_ACTOR);
67
63
  shell_wm_signals[MAXIMIZE] =
69
65
                  G_TYPE_FROM_CLASS (klass),
70
66
                  G_SIGNAL_RUN_LAST,
71
67
                  0,
72
 
                  NULL, NULL,
73
 
                  _shell_marshal_VOID__OBJECT_INT_INT_INT_INT,
 
68
                  NULL, NULL, NULL,
74
69
                  G_TYPE_NONE, 5,
75
70
                  META_TYPE_WINDOW_ACTOR, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
76
71
  shell_wm_signals[UNMAXIMIZE] =
78
73
                  G_TYPE_FROM_CLASS (klass),
79
74
                  G_SIGNAL_RUN_LAST,
80
75
                  0,
81
 
                  NULL, NULL,
82
 
                  _shell_marshal_VOID__OBJECT_INT_INT_INT_INT,
83
 
                  G_TYPE_NONE, 1,
 
76
                  NULL, NULL, NULL,
 
77
                  G_TYPE_NONE, 5,
84
78
                  META_TYPE_WINDOW_ACTOR, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
85
79
  shell_wm_signals[MAP] =
86
80
    g_signal_new ("map",
87
81
                  G_TYPE_FROM_CLASS (klass),
88
82
                  G_SIGNAL_RUN_LAST,
89
83
                  0,
90
 
                  NULL, NULL,
91
 
                  g_cclosure_marshal_VOID__OBJECT,
 
84
                  NULL, NULL, NULL,
92
85
                  G_TYPE_NONE, 1,
93
86
                  META_TYPE_WINDOW_ACTOR);
94
87
  shell_wm_signals[DESTROY] =
96
89
                  G_TYPE_FROM_CLASS (klass),
97
90
                  G_SIGNAL_RUN_LAST,
98
91
                  0,
99
 
                  NULL, NULL,
100
 
                  g_cclosure_marshal_VOID__OBJECT,
 
92
                  NULL, NULL, NULL,
101
93
                  G_TYPE_NONE, 1,
102
94
                  META_TYPE_WINDOW_ACTOR);
103
95
  shell_wm_signals[SWITCH_WORKSPACE] =
105
97
                  G_TYPE_FROM_CLASS (klass),
106
98
                  G_SIGNAL_RUN_LAST,
107
99
                  0,
108
 
                  NULL, NULL,
109
 
                  _shell_marshal_VOID__INT_INT_INT,
 
100
          NULL, NULL, NULL,
110
101
                  G_TYPE_NONE, 3,
111
102
                  G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
112
103
  shell_wm_signals[KILL_SWITCH_WORKSPACE] =
114
105
                  G_TYPE_FROM_CLASS (klass),
115
106
                  G_SIGNAL_RUN_LAST,
116
107
                  0,
117
 
                  NULL, NULL,
118
 
                  g_cclosure_marshal_VOID__VOID,
 
108
          NULL, NULL, NULL,
119
109
                  G_TYPE_NONE, 0);
120
110
  shell_wm_signals[KILL_WINDOW_EFFECTS] =
121
111
    g_signal_new ("kill-window-effects",
122
112
                  G_TYPE_FROM_CLASS (klass),
123
113
                  G_SIGNAL_RUN_LAST,
124
114
                  0,
125
 
                  NULL, NULL,
126
 
                  g_cclosure_marshal_VOID__OBJECT,
 
115
          NULL, NULL, NULL,
127
116
                  G_TYPE_NONE, 1,
128
117
                  META_TYPE_WINDOW_ACTOR);
129
 
 
130
 
  /**
131
 
   * ShellWM::keybinding:
132
 
   * @shellwm: the #ShellWM
133
 
   * @binding: the keybinding name
134
 
   * @mask: the modifier mask used
135
 
   * @window: for window keybindings, the #MetaWindow
136
 
   * @backwards: for "reversible" keybindings, whether or not
137
 
   * the backwards (Shifted) variant was invoked
138
 
   *
139
 
   * Emitted when a keybinding captured via
140
 
   * shell_wm_takeover_keybinding() is invoked. The keybinding name
141
 
   * (which has underscores, not hyphens) is also included as the
142
 
   * detail of the signal name, so you can connect just specific
143
 
   * keybindings.
144
 
   */
145
 
  shell_wm_signals[KEYBINDING] =
146
 
    g_signal_new ("keybinding",
147
 
                  G_TYPE_FROM_CLASS (klass),
148
 
                  G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
149
 
                  0,
150
 
                  NULL, NULL,
151
 
                  _shell_marshal_VOID__STRING_UINT_OBJECT_BOOLEAN,
152
 
                  G_TYPE_NONE, 4,
153
 
                  G_TYPE_STRING,
154
 
                  G_TYPE_UINT,
155
 
                  META_TYPE_WINDOW,
156
 
                  G_TYPE_BOOLEAN);
157
118
}
158
119
 
159
120
void
180
141
}
181
142
 
182
143
/**
183
 
 * shell_wm_completed_minimize
 
144
 * shell_wm_completed_minimize:
184
145
 * @wm: the ShellWM
185
146
 * @actor: the MetaWindowActor actor
186
147
 *
194
155
}
195
156
 
196
157
/**
197
 
 * shell_wm_completed_maximize
 
158
 * shell_wm_completed_maximize:
198
159
 * @wm: the ShellWM
199
160
 * @actor: the MetaWindowActor actor
200
161
 *
208
169
}
209
170
 
210
171
/**
211
 
 * shell_wm_completed_unmaximize
 
172
 * shell_wm_completed_unmaximize:
212
173
 * @wm: the ShellWM
213
174
 * @actor: the MetaWindowActor actor
214
175
 *
222
183
}
223
184
 
224
185
/**
225
 
 * shell_wm_completed_map
 
186
 * shell_wm_completed_map:
226
187
 * @wm: the ShellWM
227
188
 * @actor: the MetaWindowActor actor
228
189
 *
236
197
}
237
198
 
238
199
/**
239
 
 * shell_wm_completed_destroy
 
200
 * shell_wm_completed_destroy:
240
201
 * @wm: the ShellWM
241
202
 * @actor: the MetaWindowActor actor
242
203
 *
324
285
 
325
286
  return wm;
326
287
}
327
 
 
328
 
static void
329
 
shell_wm_key_handler (MetaDisplay    *display,
330
 
                      MetaScreen     *screen,
331
 
                      MetaWindow     *window,
332
 
                      XEvent         *event,
333
 
                      MetaKeyBinding *binding,
334
 
                      gpointer        data)
335
 
{
336
 
  ShellWM *wm = data;
337
 
  gboolean backwards = (event->xkey.state & ShiftMask);
338
 
 
339
 
  g_signal_emit (wm, shell_wm_signals[KEYBINDING],
340
 
                 g_quark_from_string (binding->name),
341
 
                 binding->name, binding->mask, window, backwards);
342
 
}
343
 
 
344
 
/**
345
 
 * shell_wm_takeover_keybinding:
346
 
 * @wm: the #ShellWM
347
 
 * @binding_name: a meta keybinding name
348
 
 *
349
 
 * Tells mutter to forward keypresses for @binding_name to the shell
350
 
 * rather than processing them internally. This will cause a
351
 
 * #ShellWM::keybinding signal to be emitted when that key is pressed.
352
 
 */
353
 
void
354
 
shell_wm_takeover_keybinding (ShellWM      *wm,
355
 
                              const char   *binding_name)
356
 
{
357
 
  meta_keybindings_set_custom_handler (binding_name,
358
 
                                       shell_wm_key_handler,
359
 
                                       wm, NULL);
360
 
}