Re: XTestFakeKeyEvent GDK-equivalent
For quick hacks or testing apps, I use xdotool. I've no idea if it works with Wayland though. -- James Cameron http://quozl.netrek.org/ ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: XTestFakeKeyEvent GDK-equivalent
On Fri, 6 Jul 2018, Anarchean wrote: On 5 July 2018 10:32 PM, Allin Cottrell wrote: [...] The context is a little different, but the attached function works, given pointers to an existing GtkWidget and GdkEvent. I tried your code out. It works OK, but its limited to emitting events to a GTK managed window and what I really wanted was to insert events into the X11/Wayland Display server, so that any application which has the focus could receive the events. Maybe that is not possible within GTK and I need to access lower-level libraries like X/Wayland? Yes, I expect so. It occurred to me after posting my variant code that it would not do what you wanted, if you're looking to send keystrokes to some arbitrary target outside of your GTK application. It seems pretty clear that if you want to send to an arbitrary X11 (or Wayland) window you'd need an API that gives you an ID for that window, at least. -- Allin Cottrell Department of Economics Wake Forest University ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: XTestFakeKeyEvent GDK-equivalent
Sent with ProtonMail Secure Email. ‐‐‐ Original Message ‐‐‐ On 6 July 2018 9:57 AM, Eric Williams 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 #include #include 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@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: XTestFakeKeyEvent GDK-equivalent
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 ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: clear() on TreeView causes select-events
Dear Reuben, thanks for your hint. On 2018-07-03 21:19 Reuben Rissler wrote: > I have had very similar experiences with liststore.clear() in > Python3.5 and Mint 18. To work around this I do: > > store = treeview.get_model() #may not be necessary in your code > treeview.set_model(None) > store.clear() > store.append('my string or etc') > treeview.set_model(store) This works. Disconnecting the "model" from the "view" before doing clear is the key. But very uncomfortable. What not worked was to unselect before doing clear. I don't understand why. This all sounds to me like a mystic behaviour what could be a bug. But I am not deep enough into Gtk so I won't open an official report about this. It is on the core devs and experts in that list to decide if this is an serious issue or not. kind Christian ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list