title: Can GDK/GTK recognize two keys pressed simultaneously?
body: <p>So I'm trying to work toward developing a platform style game, writing in C and using GTK as my graphical toolkit. Right now I have a program that places three blocks on the screen. Two of them are platforms, and the third can be moved laterally by pressing the left/right arrow keys. (I haven't drawn any sprites yet, so right now the hero of my game is a blue rectangle). I have also implemented jumping by pressing the 'z' key, and you can jump and land on the platforms.</p>
  
  <p>However, moving laterally while jumping is pretty difficult. I believe this is because my program doesn't recognize two keys pressed simultaneously, so you have to release the left or right arrow, press z, and then release z and press the right or left arrow again to move laterally while in the air. I would like to be able to hold left or right and press z simultaneously to have the hero jump laterally.</p>
  
  <p>The <a href="https://developer.gnome.org/gdk/stable/gdk-Event-Structures.html#GdkEventKey" rel="nofollow">GDK reference manual</a> refers you to 'gdk/gdkkeysyms.h' (which on my system is at /usr/include/gtk-3.0/gdk/gdkkeysyms.h) for the list of GDK key codes, but doesn't give any guidance on using two keys simultaneously. Can GTK/GDK recognize an event where two keys are pressed at the same time (GDK, GTK, whichever, I get hazy on where the line between the two is, but I suppose that's a topic for another question...)? How would you apply it? (For a single key you get the code by doing something like</p>
  
  <pre><code>key = event-&gt;keyval;
  </code></pre>
  
  <p>but I don't really know what this would look like for two keys).</p>
  
  <p>Thanks for your help!</p>