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 651875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:12:35+00:00 2026-05-13T22:12:35+00:00

I’m currently writing my own virtual keyboard for linux using the X11 lib and

  • 0

I’m currently writing my own virtual keyboard for linux using the X11 lib and i just can’t find the way to simulate a KeyPress event of any dead keys.
I’d tried , for example, to write “á” using the asigned macro, which is XK_aacute, and nothing happens.
later i’d tried to send XK_acute (the acute accent macro) and then XK_a, and again, nothing happens 🙁

In the KDE virtual Keyboard “Kvkbd” it’s possible to do this, so i downloaded the source code, but it only supports the english keyboard layout

Here is my test code:

#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
#include <iostream>

int main(){
 Display *display;
 unsigned int keycode;
 unsigned int keycode1;
 display = XOpenDisplay(NULL);

 keycode = XKeysymToKeycode(display, XK_aacute); 
 XTestFakeKeyEvent(display, keycode, True, 0);
 XTestFakeKeyEvent(display, keycode, False, 0);

 keycode1 = XKeysymToKeycode(display, XK_acute);
 XTestFakeKeyEvent(display, keycode1, True, 0);


 keycode = XKeysymToKeycode(display, XK_a);
 XTestFakeKeyEvent(display, keycode, True, 0);
 XTestFakeKeyEvent(display, keycode, False, 0);

 XTestFakeKeyEvent(display, keycode1, False, 0);


 keycode = XKeysymToKeycode(display, XK_D);
 XTestFakeKeyEvent(display, keycode, True, 0);
 XTestFakeKeyEvent(display, keycode, False, 0);
 XFlush(display);
}

Any help or idea will be much apreciated

  • 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-13T22:12:36+00:00Added an answer on May 13, 2026 at 10:12 pm

    i just figured out ¬¬

    #include <X11/extensions/XTest.h>
    #include <X11/keysym.h>
    #include <X11/Xlib.h>
    #include <iostream>
    
    int main(){
     Display *display;
     unsigned int keycode;
     unsigned int keycode1;
     display = XOpenDisplay(NULL);
    
     keycode1 = XKeysymToKeycode(display, XK_dead_acute);
     XTestFakeKeyEvent(display, keycode1, true, 0);
    
    
     keycode = XKeysymToKeycode(display, XK_A);
     XTestFakeKeyEvent(display, keycode, true, 0);
     XTestFakeKeyEvent(display, keycode, false, 0);
    
     XTestFakeKeyEvent(display, keycode1, false, 0);
    
     XFlush(display);
    }
    

    i was using the wrong macro

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

Sidebar

Related Questions

No related questions found

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.