[grits] Switch to GDK_KEY_*



commit bed3380cb43b0d9cfcb2da34fda9bb36258ae46d
Author: Andy Spencer <andy753421 gmail com>
Date:   Sun Jan 20 04:41:35 2013 +0000

    Switch to GDK_KEY_*

 examples/gl/gl.c         |    2 +-
 examples/shader/shader.c |    2 +-
 examples/sort/sort.c     |   22 +++++++++++-----------
 examples/tess/convex.c   |    2 +-
 examples/tess/split.c    |    2 +-
 examples/tester.c        |   28 ++++++++++++++--------------
 examples/tex/tex.c       |    2 +-
 examples/volume/volume.c |    8 ++++----
 src/grits-opengl.c       |   14 +++++++-------
 src/grits-test.c         |    2 +-
 src/grits-viewer.c       |   22 +++++++++++-----------
 src/plugins/test.c       |    6 +++---
 src/tile-test.c          |    2 +-
 13 files changed, 57 insertions(+), 57 deletions(-)
---
diff --git a/examples/gl/gl.c b/examples/gl/gl.c
index fd0df9e..dd33a20 100644
--- a/examples/gl/gl.c
+++ b/examples/gl/gl.c
@@ -318,7 +318,7 @@ gboolean expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
  ***************/
 gboolean key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 	return FALSE;
 }
diff --git a/examples/shader/shader.c b/examples/shader/shader.c
index 3b5f8c2..3063c26 100644
--- a/examples/shader/shader.c
+++ b/examples/shader/shader.c
@@ -39,7 +39,7 @@ gchar *gl_program_log(guint program, int *_len)
 void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 {
 	g_message("key-press");
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 }
 
diff --git a/examples/sort/sort.c b/examples/sort/sort.c
index 99e7fef..cc10fa6 100644
--- a/examples/sort/sort.c
+++ b/examples/sort/sort.c
@@ -245,17 +245,17 @@ static gboolean on_configure(GtkWidget *drawing, GdkEventConfigure *event, gpoin
 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer _)
 {
 	guint kv = event->keyval;
-	if      (kv == GDK_q) gtk_main_quit();
-	else if (kv == GDK_h) pos[0] -= 0.02;
-	else if (kv == GDK_j) pos[1] += 0.02;
-	else if (kv == GDK_k) pos[1] -= 0.02;
-	else if (kv == GDK_l) pos[0] += 0.02;
-	else if (kv == GDK_o) pos[2] -= 0.02;
-	else if (kv == GDK_i) pos[2] += 0.02;
-	else if (kv == GDK_H) rot[2] -= 2.0;
-	else if (kv == GDK_J) rot[0] += 2.0;
-	else if (kv == GDK_K) rot[0] -= 2.0;
-	else if (kv == GDK_L) rot[2] += 2.0;
+	if      (kv == GDK_KEY_q) gtk_main_quit();
+	else if (kv == GDK_KEY_h) pos[0] -= 0.02;
+	else if (kv == GDK_KEY_j) pos[1] += 0.02;
+	else if (kv == GDK_KEY_k) pos[1] -= 0.02;
+	else if (kv == GDK_KEY_l) pos[0] += 0.02;
+	else if (kv == GDK_KEY_o) pos[2] -= 0.02;
+	else if (kv == GDK_KEY_i) pos[2] += 0.02;
+	else if (kv == GDK_KEY_H) rot[2] -= 2.0;
+	else if (kv == GDK_KEY_J) rot[0] += 2.0;
+	else if (kv == GDK_KEY_K) rot[0] -= 2.0;
+	else if (kv == GDK_KEY_L) rot[2] += 2.0;
 	gtk_widget_queue_draw(widget);
 	return FALSE;
 }
diff --git a/examples/tess/convex.c b/examples/tess/convex.c
index 8840586..709b681 100644
--- a/examples/tess/convex.c
+++ b/examples/tess/convex.c
@@ -26,7 +26,7 @@ guint tex, texl, texr;
 
 gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer _)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 	return FALSE;
 }
diff --git a/examples/tess/split.c b/examples/tess/split.c
index 8d7e284..6b68ace 100644
--- a/examples/tess/split.c
+++ b/examples/tess/split.c
@@ -93,7 +93,7 @@ static gboolean on_configure(GtkWidget *drawing, GdkEventConfigure *event, gpoin
 
 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer _)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 	return FALSE;
 }
diff --git a/examples/tester.c b/examples/tester.c
index e567056..c7b7693 100644
--- a/examples/tester.c
+++ b/examples/tester.c
@@ -90,20 +90,20 @@ static gboolean on_key_press(GritsTester *tester, GdkEventKey *event, gpointer _
 
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
-	     if (kv == GDK_q) gtk_main_quit();
-        else if (kv == GDK_w) tester->wireframe = !tester->wireframe;
-	else if (kv == GDK_h) glTranslated( 0.1,  0,  0);
-	else if (kv == GDK_l) glTranslated(-0.1,  0,  0);
-	else if (kv == GDK_j) glTranslated( 0,  0.1,  0);
-	else if (kv == GDK_k) glTranslated( 0, -0.1,  0);
-	else if (kv == GDK_i) glTranslated( 0,  0,  0.1);
-	else if (kv == GDK_o) glTranslated( 0,  0, -0.1);
-	else if (kv == GDK_H) glRotated(-5, 0,1,0);
-	else if (kv == GDK_L) glRotated( 5, 0,1,0);
-	else if (kv == GDK_J) glRotated( 5, 1,0,0);
-	else if (kv == GDK_K) glRotated(-5, 1,0,0);
-	else if (kv == GDK_I) glRotated(-5, 0,0,1);
-	else if (kv == GDK_O) glRotated( 5, 0,0,1);
+	     if (kv == GDK_KEY_q) gtk_main_quit();
+        else if (kv == GDK_KEY_w) tester->wireframe = !tester->wireframe;
+	else if (kv == GDK_KEY_h) glTranslated( 0.1,  0,  0);
+	else if (kv == GDK_KEY_l) glTranslated(-0.1,  0,  0);
+	else if (kv == GDK_KEY_j) glTranslated( 0,  0.1,  0);
+	else if (kv == GDK_KEY_k) glTranslated( 0, -0.1,  0);
+	else if (kv == GDK_KEY_i) glTranslated( 0,  0,  0.1);
+	else if (kv == GDK_KEY_o) glTranslated( 0,  0, -0.1);
+	else if (kv == GDK_KEY_H) glRotated(-5, 0,1,0);
+	else if (kv == GDK_KEY_L) glRotated( 5, 0,1,0);
+	else if (kv == GDK_KEY_J) glRotated( 5, 1,0,0);
+	else if (kv == GDK_KEY_K) glRotated(-5, 1,0,0);
+	else if (kv == GDK_KEY_I) glRotated(-5, 0,0,1);
+	else if (kv == GDK_KEY_O) glRotated( 5, 0,0,1);
 	glMultMatrixd(model);
 
 	gtk_widget_queue_draw(GTK_WIDGET(tester));
diff --git a/examples/tex/tex.c b/examples/tex/tex.c
index cdd0322..b49cefa 100644
--- a/examples/tex/tex.c
+++ b/examples/tex/tex.c
@@ -25,7 +25,7 @@ guint tex, texl, texr, mask;
 
 gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer _)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 	return FALSE;
 }
diff --git a/examples/volume/volume.c b/examples/volume/volume.c
index 83e83cc..962938d 100644
--- a/examples/volume/volume.c
+++ b/examples/volume/volume.c
@@ -141,10 +141,10 @@ static VolGrid *load_radar(gchar *file, gchar *site)
  **********/
 static gboolean key_press(GritsTester *tester, GdkEventKey *event, GritsVolume *volume)
 {
-	     if (event->keyval == GDK_v) grits_volume_set_level(volume, volume->level-0.5);
-	else if (event->keyval == GDK_V) grits_volume_set_level(volume, volume->level+0.5);
-	else if (event->keyval == GDK_d) dist  += 0.5;
-	else if (event->keyval == GDK_D) dist  -= 0.5;
+	     if (event->keyval == GDK_KEY_v) grits_volume_set_level(volume, volume->level-0.5);
+	else if (event->keyval == GDK_KEY_V) grits_volume_set_level(volume, volume->level+0.5);
+	else if (event->keyval == GDK_KEY_d) dist  += 0.5;
+	else if (event->keyval == GDK_KEY_D) dist  -= 0.5;
 	return FALSE;
 }
 
diff --git a/src/grits-opengl.c b/src/grits-opengl.c
index 861bfc9..c14593e 100644
--- a/src/grits-opengl.c
+++ b/src/grits-opengl.c
@@ -399,23 +399,23 @@ static gboolean on_expose(GritsOpenGL *opengl, GdkEventExpose *event, gpointer _
 static gboolean on_key_press(GritsOpenGL *opengl, GdkEventKey *event, gpointer _)
 {
 	g_debug("GritsOpenGL: on_key_press - key=%x, state=%x, plus=%x",
-			event->keyval, event->state, GDK_plus);
+			event->keyval, event->state, GDK_KEY_plus);
 
 	guint kv = event->keyval;
 	/* Testing */
-	if (kv == GDK_w) {
+	if (kv == GDK_KEY_w) {
 		opengl->wireframe = !opengl->wireframe;
 		grits_viewer_queue_draw(GRITS_VIEWER(opengl));
 	}
-	if (kv == GDK_p) {
+	if (kv == GDK_KEY_p) {
 		opengl->pickmode = !opengl->pickmode;
 		grits_viewer_queue_draw(GRITS_VIEWER(opengl));
 	}
 #ifdef ROAM_DEBUG
-	else if (kv == GDK_n) roam_sphere_split_one(opengl->sphere);
-	else if (kv == GDK_p) roam_sphere_merge_one(opengl->sphere);
-	else if (kv == GDK_r) roam_sphere_split_merge(opengl->sphere);
-	else if (kv == GDK_u) roam_sphere_update_errors(opengl->sphere);
+	else if (kv == GDK_KEY_n) roam_sphere_split_one(opengl->sphere);
+	else if (kv == GDK_KEY_p) roam_sphere_merge_one(opengl->sphere);
+	else if (kv == GDK_KEY_r) roam_sphere_split_merge(opengl->sphere);
+	else if (kv == GDK_KEY_u) roam_sphere_update_errors(opengl->sphere);
 	grits_viewer_queue_draw(GRITS_VIEWER(opengl));
 #endif
 	return FALSE;
diff --git a/src/grits-test.c b/src/grits-test.c
index 10d59ec..1a9a4cc 100644
--- a/src/grits-test.c
+++ b/src/grits-test.c
@@ -47,7 +47,7 @@ static gboolean on_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
 static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event,
 		gpointer _)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		return grits_shutdown(widget);
 	return FALSE;
 }
diff --git a/src/grits-viewer.c b/src/grits-viewer.c
index 86d00c4..1afd2ea 100644
--- a/src/grits-viewer.c
+++ b/src/grits-viewer.c
@@ -117,22 +117,22 @@ static void _grits_viewer_emit_offline(GritsViewer *viewer)
 static gboolean on_key_press(GritsViewer *viewer, GdkEventKey *event, gpointer _)
 {
 	g_debug("GritsViewer: on_key_press - key=%x, state=%x, plus=%x",
-			event->keyval, event->state, GDK_plus);
+			event->keyval, event->state, GDK_KEY_plus);
 
 	double lat, lon, elev, pan;
 	grits_viewer_get_location(viewer, &lat, &lon, &elev);
 	pan = MIN(elev/(EARTH_R/2), 30);
 	switch (event->keyval) {
-	case GDK_Left:  case GDK_h: grits_viewer_pan(viewer,  0,  -pan, 0); break;
-	case GDK_Down:  case GDK_j: grits_viewer_pan(viewer, -pan, 0,   0); break;
-	case GDK_Up:    case GDK_k: grits_viewer_pan(viewer,  pan, 0,   0); break;
-	case GDK_Right: case GDK_l: grits_viewer_pan(viewer,  0,   pan, 0); break;
-	case GDK_minus: case GDK_o: grits_viewer_zoom(viewer, 10./9); break;
-	case GDK_plus:  case GDK_i: grits_viewer_zoom(viewer, 9./10); break;
-	case GDK_H: grits_viewer_rotate(viewer,  0, 0, -2); break;
-	case GDK_J: grits_viewer_rotate(viewer,  2, 0,  0); break;
-	case GDK_K: grits_viewer_rotate(viewer, -2, 0,  0); break;
-	case GDK_L: grits_viewer_rotate(viewer,  0, 0,  2); break;
+	case GDK_KEY_Left:  case GDK_KEY_h: grits_viewer_pan(viewer,  0,  -pan, 0); break;
+	case GDK_KEY_Down:  case GDK_KEY_j: grits_viewer_pan(viewer, -pan, 0,   0); break;
+	case GDK_KEY_Up:    case GDK_KEY_k: grits_viewer_pan(viewer,  pan, 0,   0); break;
+	case GDK_KEY_Right: case GDK_KEY_l: grits_viewer_pan(viewer,  0,   pan, 0); break;
+	case GDK_KEY_minus: case GDK_KEY_o: grits_viewer_zoom(viewer, 10./9); break;
+	case GDK_KEY_plus:  case GDK_KEY_i: grits_viewer_zoom(viewer, 9./10); break;
+	case GDK_KEY_H: grits_viewer_rotate(viewer,  0, 0, -2); break;
+	case GDK_KEY_J: grits_viewer_rotate(viewer,  2, 0,  0); break;
+	case GDK_KEY_K: grits_viewer_rotate(viewer, -2, 0,  0); break;
+	case GDK_KEY_L: grits_viewer_rotate(viewer,  0, 0,  2); break;
 	}
 	return FALSE;
 }
diff --git a/src/plugins/test.c b/src/plugins/test.c
index cfc999b..2c3e52f 100644
--- a/src/plugins/test.c
+++ b/src/plugins/test.c
@@ -65,9 +65,9 @@ static gboolean on_poly_key(GritsPoly *poly, GdkEventKey *event)
 {
 	g_debug("GritsPluginTest: on_poly_key - %d", event->keyval);
 	gdouble colors[0xff][3] = {
-		[GDK_r] {1, 0, 0},
-		[GDK_g] {0, 1, 0},
-		[GDK_b] {0, 0, 1},
+		[GDK_KEY_r] {1, 0, 0},
+		[GDK_KEY_g] {0, 1, 0},
+		[GDK_KEY_b] {0, 0, 1},
 	};
 	if (event->keyval >= G_N_ELEMENTS(colors))
 		return FALSE;
diff --git a/src/tile-test.c b/src/tile-test.c
index aeb01ff..092c6d2 100644
--- a/src/tile-test.c
+++ b/src/tile-test.c
@@ -127,7 +127,7 @@ gpointer do_osm2_cache(gpointer _image)
 
 gboolean key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 {
-	if (event->keyval == GDK_q)
+	if (event->keyval == GDK_KEY_q)
 		gtk_main_quit();
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]