mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
keybindings: Port to Clutter
This commit is contained in:
parent
e6790038dd
commit
666e5f1f98
@ -474,10 +474,9 @@ void meta_display_queue_autoraise_callback (MetaDisplay *display,
|
|||||||
void meta_display_remove_autoraise_callback (MetaDisplay *display);
|
void meta_display_remove_autoraise_callback (MetaDisplay *display);
|
||||||
|
|
||||||
void meta_display_overlay_key_activate (MetaDisplay *display);
|
void meta_display_overlay_key_activate (MetaDisplay *display);
|
||||||
void meta_display_accelerator_activate (MetaDisplay *display,
|
void meta_display_accelerator_activate (MetaDisplay *display,
|
||||||
guint action,
|
guint action,
|
||||||
guint deviceid,
|
ClutterKeyEvent *event);
|
||||||
guint timestamp);
|
|
||||||
gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
|
gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
|
||||||
|
|
||||||
/* In above-tab-keycode.c */
|
/* In above-tab-keycode.c */
|
||||||
|
@ -2234,7 +2234,8 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
|
|
||||||
display->current_time = event->any.time;
|
display->current_time = event->any.time;
|
||||||
|
|
||||||
if (window && !window->override_redirect && event->type == CLUTTER_BUTTON_PRESS)
|
if (window && !window->override_redirect &&
|
||||||
|
(event->type == CLUTTER_KEY_PRESS || event->type == CLUTTER_BUTTON_PRESS))
|
||||||
{
|
{
|
||||||
if (CurrentTime == display->current_time)
|
if (CurrentTime == display->current_time)
|
||||||
{
|
{
|
||||||
@ -2454,6 +2455,17 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
meta_window_handle_mouse_grab_op_event (window, event);
|
meta_window_handle_mouse_grab_op_event (window, event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_KEY_PRESS:
|
||||||
|
case CLUTTER_KEY_RELEASE:
|
||||||
|
/* For key events, it's important to enforce single-handling, or
|
||||||
|
* we can get into a confused state. So if a keybinding is
|
||||||
|
* handled (because it's one of our hot-keys, or because we are
|
||||||
|
* in a keyboard-grabbed mode like moving a window, we don't
|
||||||
|
* want to pass the key event to the compositor or GTK+ at all.
|
||||||
|
*/
|
||||||
|
if (meta_display_process_key_event (display, window, (ClutterKeyEvent *) event))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2476,39 +2488,8 @@ handle_input_xevent (MetaDisplay *display,
|
|||||||
modified = xievent_get_modified_window (display, input_event);
|
modified = xievent_get_modified_window (display, input_event);
|
||||||
window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
|
window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
|
||||||
|
|
||||||
if (window && !window->override_redirect && input_event->type == XI_KeyPress)
|
|
||||||
{
|
|
||||||
if (CurrentTime == display->current_time)
|
|
||||||
{
|
|
||||||
/* We can't use missing (i.e. invalid) timestamps to set user time,
|
|
||||||
* nor do we want to use them to sanity check other timestamps.
|
|
||||||
* See bug 313490 for more details.
|
|
||||||
*/
|
|
||||||
meta_warning ("Event has no timestamp! You may be using a broken "
|
|
||||||
"program such as xse. Please ask the authors of that "
|
|
||||||
"program to fix it.\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
meta_window_set_user_time (window, display->current_time);
|
|
||||||
sanity_check_timestamps (display, display->current_time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (input_event->evtype)
|
switch (input_event->evtype)
|
||||||
{
|
{
|
||||||
case XI_KeyPress:
|
|
||||||
case XI_KeyRelease:
|
|
||||||
|
|
||||||
/* For key events, it's important to enforce single-handling, or
|
|
||||||
* we can get into a confused state. So if a keybinding is
|
|
||||||
* handled (because it's one of our hot-keys, or because we are
|
|
||||||
* in a keyboard-grabbed mode like moving a window, we don't
|
|
||||||
* want to pass the key event to the compositor or GTK+ at all.
|
|
||||||
*/
|
|
||||||
if (meta_display_process_key_event (display, window, (XIDeviceEvent *) input_event))
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
case XI_Enter:
|
case XI_Enter:
|
||||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||||
break;
|
break;
|
||||||
@ -6050,13 +6031,14 @@ meta_display_overlay_key_activate (MetaDisplay *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_display_accelerator_activate (MetaDisplay *display,
|
meta_display_accelerator_activate (MetaDisplay *display,
|
||||||
guint action,
|
guint action,
|
||||||
guint deviceid,
|
ClutterKeyEvent *event)
|
||||||
guint timestamp)
|
|
||||||
{
|
{
|
||||||
g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED],
|
g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED],
|
||||||
0, action, deviceid, timestamp);
|
0, action,
|
||||||
|
clutter_input_device_get_device_id (event->device),
|
||||||
|
event->time);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -66,9 +66,9 @@ gboolean meta_window_grab_all_keys (MetaWindow *window,
|
|||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
void meta_window_ungrab_all_keys (MetaWindow *window,
|
void meta_window_ungrab_all_keys (MetaWindow *window,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
gboolean meta_display_process_key_event (MetaDisplay *display,
|
gboolean meta_display_process_key_event (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XIDeviceEvent *event);
|
ClutterKeyEvent *event);
|
||||||
void meta_display_process_mapping_event (MetaDisplay *display,
|
void meta_display_process_mapping_event (MetaDisplay *display,
|
||||||
XEvent *event);
|
XEvent *event);
|
||||||
|
|
||||||
@ -81,7 +81,3 @@ gboolean meta_prefs_remove_keybinding (const char *name);
|
|||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/XInput.h>
|
#include <X11/extensions/XInput.h>
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
|
#include <clutter/clutter.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -391,17 +391,17 @@ struct _MetaKeyCombo
|
|||||||
* @display: a #MetaDisplay
|
* @display: a #MetaDisplay
|
||||||
* @screen: a #MetaScreen
|
* @screen: a #MetaScreen
|
||||||
* @window: a #MetaWindow
|
* @window: a #MetaWindow
|
||||||
* @event: (type gpointer): a #XIDeviceEvent
|
* @event: a #ClutterKeyEvent
|
||||||
* @binding: a #MetaKeyBinding
|
* @binding: a #MetaKeyBinding
|
||||||
* @user_data: data passed to the function
|
* @user_data: data passed to the function
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
|
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XIDeviceEvent *event,
|
ClutterKeyEvent *event,
|
||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
typedef struct _MetaKeyHandler MetaKeyHandler;
|
typedef struct _MetaKeyHandler MetaKeyHandler;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user