Commit 1fcb6194 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Remove forward declaration

parent c4594beb
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <string.h> #include <string.h>
static void girara_toggle_widget_visibility(GtkWidget* widget); static void girara_toggle_widget_visibility(GtkWidget* widget);
static bool simulate_key_press(girara_session_t* session, int state, int key);
bool bool
girara_shortcut_add(girara_session_t* session, guint modifier, guint key, const char* buffer, girara_shortcut_function_t function, girara_mode_t mode, int argument_n, void* argument_data) girara_shortcut_add(girara_session_t* session, guint modifier, guint key, const char* buffer, girara_shortcut_function_t function, girara_mode_t mode, int argument_n, void* argument_data)
...@@ -460,6 +459,45 @@ girara_sc_exec(girara_session_t* session, girara_argument_t* argument, girara_ev ...@@ -460,6 +459,45 @@ girara_sc_exec(girara_session_t* session, girara_argument_t* argument, girara_ev
return false; return false;
} }
static bool
simulate_key_press(girara_session_t* session, int state, int key)
{
if (session == NULL || session->gtk.box == NULL) {
return false;
}
GdkEvent* event = gdk_event_new(GDK_KEY_PRESS);
event->any.type = GDK_KEY_PRESS;
event->key.window = g_object_ref(gtk_widget_get_parent_window(GTK_WIDGET(session->gtk.box)));
event->key.send_event = false;
event->key.time = GDK_CURRENT_TIME;
event->key.state = state;
event->key.keyval = key;
GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(session->gtk.box));
GdkKeymapKey* keys = NULL;
gint number_of_keys = 0;
if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_for_display(display),
event->key.keyval, &keys, &number_of_keys) == FALSE) {
gdk_event_free(event);
return false;
}
event->key.hardware_keycode = keys[0].keycode;
event->key.group = keys[0].group;
g_free(keys);
gdk_event_put(event);
gdk_event_free(event);
gtk_main_iteration_do(FALSE);
return true;
}
bool bool
girara_sc_feedkeys(girara_session_t* session, girara_argument_t* argument, girara_sc_feedkeys(girara_session_t* session, girara_argument_t* argument,
girara_event_t* UNUSED(event), unsigned int t) girara_event_t* UNUSED(event), unsigned int t)
...@@ -733,42 +771,3 @@ girara_mouse_event_free(girara_mouse_event_t* mouse_event) ...@@ -733,42 +771,3 @@ girara_mouse_event_free(girara_mouse_event_t* mouse_event)
} }
g_slice_free(girara_mouse_event_t, mouse_event); g_slice_free(girara_mouse_event_t, mouse_event);
} }
static bool
simulate_key_press(girara_session_t* session, int state, int key)
{
if (session == NULL || session->gtk.box == NULL) {
return false;
}
GdkEvent* event = gdk_event_new(GDK_KEY_PRESS);
event->any.type = GDK_KEY_PRESS;
event->key.window = g_object_ref(gtk_widget_get_parent_window(GTK_WIDGET(session->gtk.box)));
event->key.send_event = false;
event->key.time = GDK_CURRENT_TIME;
event->key.state = state;
event->key.keyval = key;
GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(session->gtk.box));
GdkKeymapKey* keys = NULL;
gint number_of_keys = 0;
if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_for_display(display),
event->key.keyval, &keys, &number_of_keys) == FALSE) {
gdk_event_free(event);
return false;
}
event->key.hardware_keycode = keys[0].keycode;
event->key.group = keys[0].group;
g_free(keys);
gdk_event_put(event);
gdk_event_free(event);
gtk_main_iteration_do(FALSE);
return true;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment