bool
NativeKeyBindings::ExecuteInternal(const WidgetKeyboardEvent& aEvent,
                                   DoCommandCallback aCallback,
                                   void* aCallbackData,
                                   guint aKeyval)
{
  guint modifiers =
    static_cast<GdkEventKey*>(aEvent.mNativeKeyEvent)->state;

  gCurrentCallback = aCallback;
  gCurrentCallbackData = aCallbackData;

  gHandled = false;
#if (MOZ_WIDGET_GTK == 2)
  gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
                        aKeyval, GdkModifierType(modifiers));
#else
  gtk_bindings_activate(G_OBJECT(mNativeTarget),
                        aKeyval, GdkModifierType(modifiers));
#endif

  gCurrentCallback = nullptr;
  gCurrentCallbackData = nullptr;

  return gHandled;
}
示例#2
0
/**
 * uni_nav_key_press:
 *
 * Keyboard events are catched just to forward them to the
 * #UniImageView which responds to them. That way, keyboard navigation
 * in #UniNav behaves consistently with #UniImageView.
 **/
static int
uni_nav_key_press (GtkWidget * widget, GdkEventKey * ev)
{
    UniNav *nav = UNI_NAV (widget);
    int retval = gtk_bindings_activate (GTK_OBJECT (nav->view),
                                        ev->keyval,
                                        ev->state);
    uni_nav_draw_rectangle (nav, TRUE);
    return retval;
}
示例#3
0
static void
xplayer_fullscreen_force_popup_hide (XplayerFullscreen *fs)
{
	/* Popdown the volume button if it's visible */
	if (xplayer_fullscreen_is_volume_popup_visible (fs))
		gtk_bindings_activate (G_OBJECT (fs->volume), GDK_KEY_Escape, 0);

	gtk_widget_hide (fs->priv->exit_popup);
	gtk_widget_hide (fs->priv->control_popup);

	xplayer_fullscreen_popup_timeout_remove (fs);

	xplayer_fullscreen_set_cursor (fs, FALSE);
}
示例#4
0
static gboolean
panel_key_press_event (GtkWidget   *widget,
		       GdkEventKey *event)
{
	/*
  	 * If the focus widget is a GtkSocket, i.e. the
	 * focus is in an applet in another process, then key 
	 * bindings do not work. We get around this by
	 * activating the key bindings here.
	 */ 
	if (GTK_IS_SOCKET (gtk_window_get_focus (GTK_WINDOW (widget))) &&
	    event->keyval == GDK_F10 &&
	    (event->state & gtk_accelerator_get_default_mod_mask ()) == GDK_CONTROL_MASK)
		return gtk_bindings_activate (GTK_OBJECT (widget),
					      event->keyval,
					      event->state);

	return FALSE;
}
void
_pluma_cmd_search_incremental_search (GtkAction   *action,
				      PlumaWindow *window)
{
	PlumaView *active_view;

	pluma_debug (DEBUG_COMMANDS);

	active_view = pluma_window_get_active_view (window);
	if (active_view == NULL)
		return;

	/* Focus the view if needed: we need to focus the view otherwise 
	   activating the binding for incremental search has no effect */
	gtk_widget_grab_focus (GTK_WIDGET (active_view));
	
	/* incremental search is builtin in PlumaView, just activate
	 * the corrisponding binding.
	 */
	gtk_bindings_activate (GTK_OBJECT (active_view),
			       GDK_k,
			       GDK_CONTROL_MASK);
}