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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:35:32+00:00 2026-06-08T17:35:32+00:00

I am writing a C program to control an ARDrone, and would like the

  • 0

I am writing a C program to control an ARDrone, and would like the drone to move as long as a key is pressed down, and when the key is no longer pressed down I want it to stop moving. I attached both a key_press_event and key_release_event to the window I created, and here is the callback function:

gint key_press_cb(GtkWidget *widget, 
                GdkEventKey *kevent, 
                gpointer data)
{ 
unsigned int key;
int res;

/* While a key is pressed the drone moves,
 * when the key is released it is put back into hover mode */
if(kevent->type == GDK_KEY_RELEASE) {
    // Hover mode
    printf("--- Hover Mode ---\n");
    ardrone_at_set_progress_cmd(0, 0, 0, 0, 0);
    //res = keyboard_update(BACKSPACE);
} else if(kevent->type == GDK_KEY_PRESS) {

    key = kevent->keyval;
    g_message("Key pressed: %c [%d]", key, key);

    res = keyboard_update(key); 
}

return TRUE;
}

I will get a key release event if I hold down the key for a short period of time, but when holding it down for 2+ seconds I will not see the key release event. I was thinking it could be because I am constantly receiving key_press_events while holding down a key; is there any way to disable that repeat?

  • 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-06-08T17:35:33+00:00Added an answer on June 8, 2026 at 5:35 pm

    I found the problem if anyone was wondering. In my keyboard_update() function I was calling g_signal_emit_by_name(G_OBJECT(/*button*/), "activate", NULL) to have the button pressed down when the user pressed the corresponding key. Once I removed this feature the key release event was being recognized again. Not sure why this happens but I can live without this feature for now.

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

Sidebar

Related Questions

I am writing a program for WP7 in C# where I would like to
Basically, i want to write a windows form program like any other webcam's control
I'm currently writing a program in Java that I would like to use to
Basically, i want to write a windows form program like any other webcam's control
I am writing an access control program in Java that captures passwords using JPasswordField
I've been writing a program in C to move the first 4 bits of
I am writing a program in VS 2005 and I wanna control the access
I'm writing a c# application which uses automation to control another program. Naturally that
I am writing a program to control an Iridium modem that communicates with a
I am currently writing a remote control program to control a robot on all

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.