Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On 6 July 2018 9:57 AM, Eric Williams <ericwill@xxxxxxxxxx> wrote: > Hello, > > On 07/05/2018 02:40 PM, Anarchean via gtk-list wrote: > > > Hi, > > > > I'm working into implementing a virtual remote keyboard/touch pad daemon > > > > for Linux, currently I'm dumping events into an uinput device, but that > > > > is giving me some trouble with my keyboard layout (which is brazillian, > > > > br-abnt2). I was looking for a way to this in X, found XTestFakeKeyEvent > > > > and was wondering if I could make it simpler and cross-platform using > > > > GDK3. I tried this attached code, but it doesn't do anything. I was > > > > wondering if someone has done this before and know what I'm doing wrong > > > > or if I should just give up doing with GDK. > > Perhaps something like this? > > https://developer.gnome.org/gdk3/stable/gdk3-Testing.html#gdk-test-simulate-key > > > ----------------------------------------------------------------------------------------------------------------- > > Eric Williams > > Software Engineer - Eclipse/SWT Team > > Red Hat Hey, Eric. I've just tried that function, it didn't do anything, I'm attaching my code so you can see if I'm doing this wrong.
#include <gdk/gdk.h> #include <gio/gio.h> #include <gtk/gtk.h> GdkWindow* gSuperWindow; static gboolean press_key (gpointer data) { GdkWindow *window; GdkModifierType NO_MODIFIER = (GdkModifierType) 0; int* c = (int *) data; window = gdk_get_default_root_window(); gdk_test_simulate_key (gSuperWindow, -1, -1, GDK_KEY_a, NO_MODIFIER, GDK_KEY_PRESS); gdk_test_simulate_key (gSuperWindow, -1, -1, GDK_KEY_a, NO_MODIFIER, GDK_KEY_RELEASE); (*c)++; printf("Char printed\n"); if (*c < 10) { return TRUE; } else { return FALSE; } } static void activate (GApplication* app) { GtkWidget* window; GtkWidget* text; window = gtk_application_window_new (GTK_APPLICATION (app)); text = gtk_entry_new (); gtk_container_add (GTK_CONTAINER (window), text); gtk_widget_show_all (window); gSuperWindow = gtk_widget_get_window (window); g_timeout_add (500, press_key, new int {0}); } int main(int argc, char** argv) { GtkApplication* app; int status; app = gtk_application_new ("linuxrc.eric", G_APPLICATION_FLAGS_NONE); g_signal_connect (app, "activate", G_CALLBACK (activate), app); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; }
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list