Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:17:39+00:00 2026-05-24T22:17:39+00:00

I am trying to dispatch (inject) a GTK keyboard event to some window, in

  • 0

I am trying to dispatch (inject) a GTK keyboard event to some window, in specific the window with a webkit webview inside of it. Problem that I have is with special keys like Backspace, Up, Down etc. For some reason they are not injected properly, meaning that corresponding functionality is not triggered. For other keys it works perfectly. I tried to focus the keyboard on the window and put the window on the top of the window z-index stack, but it doesn’t help.

GdkEvent* const event = gdk_event_new(GDK_KEY_PRESS); 
event->key.window = self->window->window; 
event->key.send_event = TRUE; 
event->key.time = GDK_CURRENT_TIME; 
event->key.state = 0; event->key.keyval = key_value; 
event->key.hardware_keycode = 0;
event->key.length = 0; event->key.string = 0; 
event->key.group = 0; 
//key_value is the code for the key. 

This is the C to Python binding part where I just pass a keycode (key_value) to the function. I do the similar thing for key release event (GDK_KEY_RELEASE). In Python part I call those two functions (press and then release) and it works for normal keys like for a, s, d, etc. However, it doesn’t work for BackSpace, Enter, Delete etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:17:40+00:00Added an answer on May 24, 2026 at 10:17 pm

    I solved the problem by using the KeyMap object that I get with gtk.gdk.keymap_get_default(). KeyMap has method get_entries_for_keyval(keycode) to which you need to pass just the value of keycode. It returns a triple: hardware_code, group and level. So when I passed the hardware_code and group everything started to work, except arrow keys.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about the event dispatch. I am trying to write the
I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of
What i am trying to do is to dispatch the motion event to currently
I'm trying to write some unit tests for a gwt-dispatch service with JUnit. I'm
In a FLEX app, I am trying to re-dispatch a custom event. I.e. component1
Basically I'm trying to dispatch a custom made mouse click event to a text
I am trying to dispatch a custom event from one flex module to another.
I am making mouse click events and I'm trying to dispatch it to some
Eventdispatching here we are again... I'm trying to dispatch a custom event from an
I'm trying to implement a dispatch table, so that I can call a selector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.