mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-09 22:50:24 +01:00
Add a CONTROL-Q keybinding to quit.
This commit is contained in:
parent
29479a8b12
commit
3bcaab9fe1
2 changed files with 22 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2006-01-26 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* doc/tutorial/src/include/cairo-tutorial-gtk.h: Add a CONTROL-Q
|
||||
keybinding to quit.
|
||||
|
||||
2006-01-26 Keith Packard <keithp@keithp.com>
|
||||
|
||||
reviewed by: cworth
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#ifndef WIDTH
|
||||
|
|
@ -87,6 +89,18 @@ handle_expose (GtkWidget *widget,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_key_press (GtkWidget *widget,
|
||||
GdkEventKey *event,
|
||||
gpointer data)
|
||||
{
|
||||
if ((event->keyval == GDK_Q ||
|
||||
event->keyval == GDK_q) && (event->state & GDK_CONTROL_MASK))
|
||||
gtk_main_quit ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
|
@ -108,6 +122,9 @@ main (int argc, char **argv)
|
|||
g_signal_connect (drawing_area, "expose-event",
|
||||
G_CALLBACK (handle_expose), NULL);
|
||||
|
||||
g_signal_connect (window, "key-press-event",
|
||||
G_CALLBACK (handle_key_press), NULL);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
gtk_main ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue