changeset 84:ba3c39002a24

Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net> * img-view.c, layout_image.c, layout_util.c: Keypress signal handler code clean-up round 1: the main windows. Also fixes [Shift]+[F] from deactivating full screen [F].
author gqview
date Fri, 20 Oct 2006 12:03:16 +0000
parents 4a0091c0c231
children 9d5c75b5ec28
files ChangeLog src/img-view.c src/layout_image.c src/layout_util.c
diffstat 4 files changed, 351 insertions(+), 352 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 19 19:32:31 2006 +0000
+++ b/ChangeLog	Fri Oct 20 12:03:16 2006 +0000
@@ -1,3 +1,9 @@
+Fri Oct 20 08:00:08 2006  John Ellis  <johne@verizon.net>
+
+	* img-view.c, layout_image.c, layout_util.c: Keypress signal handler
+	code clean-up round 1: the main windows. Also fixes [Shift]+[F] from
+	deactivating full screen [F].
+
 Thu Oct 19 15:20:51 2006  John Ellis  <johne@verizon.net>
 
 	* image.c, typedefs.h: Add ALTER_DESATURATE alteration type.
--- a/src/img-view.c	Thu Oct 19 19:32:31 2006 +0000
+++ b/src/img-view.c	Fri Oct 20 12:03:16 2006 +0000
@@ -326,153 +326,52 @@
 {
 	ViewWindow *vw = data;
 	ImageWindow *imd;
-	gint stop_signal = FALSE;
+	gint stop_signal;
 	GtkWidget *menu;
 	gint x = 0;
 	gint y = 0;
 
 	imd = view_window_active_image(vw);
 
+	stop_signal = TRUE;
 	switch (event->keyval)
 		{
 		case GDK_Left: case GDK_KP_Left:
 			x -= 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Right: case GDK_KP_Right:
 			x += 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Up: case GDK_KP_Up:
 			y -= 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Down: case GDK_KP_Down:
 			y += 1;
-			stop_signal = TRUE;
+			break;
+		default:
+			stop_signal = FALSE;
 			break;
 		}
 
-	if ( !(event->state & GDK_CONTROL_MASK) )
-	    switch (event->keyval)
+	if (x != 0 || y!= 0)
 		{
-		case GDK_Page_Up: case GDK_KP_Page_Up:
-		case GDK_BackSpace:
-		case 'B': case 'b':
-			view_step_prev(vw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Page_Down: case GDK_KP_Page_Down:
-		case GDK_space:
-		case 'N': case 'n':
-			view_step_next(vw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Home: case GDK_KP_Home:
-			view_step_to_end(vw, FALSE);
-			stop_signal = TRUE;
-			break;
-		case GDK_End: case GDK_KP_End:
-			view_step_to_end(vw, TRUE);
-			stop_signal = TRUE;
-			break;
-		case '+': case '=': case GDK_KP_Add:
-			image_zoom_adjust(imd, get_zoom_increment());
-			break;
-		case '-': case GDK_KP_Subtract:
-			image_zoom_adjust(imd, -get_zoom_increment());
-			break;
-		case 'X': case 'x': case GDK_KP_Multiply:
-			image_zoom_set(imd, 0.0);
-			break;
-		case 'Z': case 'z': case GDK_KP_Divide: case '1':
-			image_zoom_set(imd, 1.0);
-			break;
-		case '2':
-			image_zoom_set(imd, 2.0);
-			break;
-		case '3':
-			image_zoom_set(imd, 3.0);
-			break;
-		case '4':
-			image_zoom_set(imd, 4.0);
-			break;
-		case '7':
-			image_zoom_set(imd, -4.0);
-			break;
-		case '8':
-			image_zoom_set(imd, -3.0);
-			break;
-		case '9':
-			image_zoom_set(imd, -2.0);
-			break;
-		case 'W': case 'w':
-			image_zoom_set_fill_geometry(imd, FALSE);
-			break;
-		case 'H': case 'h':
-			image_zoom_set_fill_geometry(imd, TRUE);
-			break;
-		case 'R': case 'r':
-			if (!event->state & GDK_SHIFT_MASK)
-				{
-				image_reload(imd);
-				}
-			break;
-		case 'S': case 's':
-			if (vw->ss)
-				view_slideshow_stop(vw);
-			else
-				view_slideshow_start(vw);
-			stop_signal = TRUE;
-			break;
-		case 'P': case 'p':
-			slideshow_pause_toggle(vw->ss);
-			break;
-		case 'F': case 'f':
-		case 'V': case 'v':
-			view_fullscreen_toggle(vw, FALSE);
-			stop_signal = TRUE;
-			break;
-		case 'I': case 'i':
-			view_overlay_toggle(vw);
-			break;
-		case ']':
-			image_alter(imd, ALTER_ROTATE_90);
-			stop_signal = TRUE;
-			break;
-		case '[':
-			image_alter(imd, ALTER_ROTATE_90_CC);
-			stop_signal = TRUE;
-			break;
-		case GDK_Delete: case GDK_KP_Delete:
-			if (enable_delete_key)
-				{
-				file_util_delete(image_get_path(imd), NULL, imd->widget);
-				stop_signal = TRUE;
-				}
-			break;
-		case GDK_Escape:
-			if (vw->fs)
-				{
-				view_fullscreen_toggle(vw, TRUE);
-				}
-			else
-				{
-				gtk_widget_destroy(vw->window);
-				}
-			stop_signal = TRUE;
-			break;
-		case GDK_Menu:
-		case GDK_F10:
-			menu = view_popup_menu(vw);
-			gtk_menu_popup(GTK_MENU(menu), NULL, NULL, view_window_menu_pos_cb, vw, 0, GDK_CURRENT_TIME);
-			stop_signal = TRUE;
-			break;
+		if (event->state & GDK_SHIFT_MASK)
+			{
+			x *= 3;
+			y *= 3;
+			}
+
+		keyboard_scroll_calc(&x, &y, event);
+		image_scroll(imd, x, y);
 		}
 
+	if (stop_signal) return stop_signal;
+
 	if (event->state & GDK_CONTROL_MASK)
 		{
 		gint n = -1;
+
+		stop_signal = TRUE;
 		switch (event->keyval)
 			{
 			case '1':
@@ -507,27 +406,25 @@
 				break;
 			case 'C': case 'c':
 				file_util_copy(image_get_path(imd), NULL, NULL, imd->widget);
-				stop_signal = TRUE;
 				break;
 			case 'M': case 'm':
 				file_util_move(image_get_path(imd), NULL, NULL, imd->widget);
-				stop_signal = TRUE;
 				break;
 			case 'R': case 'r':
 				file_util_rename(image_get_path(imd), NULL, imd->widget);
-				stop_signal = TRUE;
 				break;
 			case 'D': case 'd':
 				file_util_delete(image_get_path(imd), NULL, imd->widget);
-				stop_signal = TRUE;
 				break;
 			case 'P': case 'p':
 				info_window_new(image_get_path(imd), NULL);
-				stop_signal = TRUE;
 				break;
 			case 'W': case 'w':
 				view_window_close(vw);
 				break;
+			default:
+				stop_signal = FALSE;
+				break;
 			}
 		if (n != -1)
 			{
@@ -541,35 +438,138 @@
 		}
 	else if (event->state & GDK_SHIFT_MASK)
 		{
+		stop_signal = TRUE;
 		switch (event->keyval)
 			{
 			case 'R': case 'r':
 				image_alter(imd, ALTER_ROTATE_180);
-				stop_signal = TRUE;
 				break;
 			case 'M': case 'm':
 				image_alter(imd, ALTER_MIRROR);
-				stop_signal = TRUE;
 				break;
 			case 'F': case 'f':
 				image_alter(imd, ALTER_FLIP);
-				stop_signal = TRUE;
 				break;
 			case 'G': case 'g':
 				image_alter(imd, ALTER_DESATURATE);
-				stop_signal = TRUE;
 				break;
 			default:
+				stop_signal = FALSE;
 				break;
 			}
-		x *= 3;
-		y *= 3;
 		}
-
-	if (x != 0 || y!= 0)
+	else 
 		{
-		keyboard_scroll_calc(&x, &y, event);
-		image_scroll(imd, x, y);
+		stop_signal = TRUE;
+		switch (event->keyval)
+			{
+			case GDK_Page_Up: case GDK_KP_Page_Up:
+			case GDK_BackSpace:
+			case 'B': case 'b':
+				view_step_prev(vw);
+				break;
+			case GDK_Page_Down: case GDK_KP_Page_Down:
+			case GDK_space:
+			case 'N': case 'n':
+				view_step_next(vw);
+				break;
+			case GDK_Home: case GDK_KP_Home:
+				view_step_to_end(vw, FALSE);
+				break;
+			case GDK_End: case GDK_KP_End:
+				view_step_to_end(vw, TRUE);
+				break;
+			case '+': case '=': case GDK_KP_Add:
+				image_zoom_adjust(imd, get_zoom_increment());
+				break;
+			case '-': case GDK_KP_Subtract:
+				image_zoom_adjust(imd, -get_zoom_increment());
+				break;
+			case 'X': case 'x': case GDK_KP_Multiply:
+				image_zoom_set(imd, 0.0);
+				break;
+			case 'Z': case 'z': case GDK_KP_Divide: case '1':
+				image_zoom_set(imd, 1.0);
+				break;
+			case '2':
+				image_zoom_set(imd, 2.0);
+				break;
+			case '3':
+				image_zoom_set(imd, 3.0);
+				break;
+			case '4':
+				image_zoom_set(imd, 4.0);
+				break;
+			case '7':
+				image_zoom_set(imd, -4.0);
+				break;
+			case '8':
+				image_zoom_set(imd, -3.0);
+				break;
+			case '9':
+				image_zoom_set(imd, -2.0);
+				break;
+			case 'W': case 'w':
+				image_zoom_set_fill_geometry(imd, FALSE);
+				break;
+			case 'H': case 'h':
+				image_zoom_set_fill_geometry(imd, TRUE);
+				break;
+			case 'R': case 'r':
+				image_reload(imd);
+				break;
+			case 'S': case 's':
+				if (vw->ss)
+					{
+					view_slideshow_stop(vw);
+					}
+				else
+					{
+					view_slideshow_start(vw);
+					}
+				break;
+			case 'P': case 'p':
+				slideshow_pause_toggle(vw->ss);
+				break;
+			case 'F': case 'f':
+			case 'V': case 'v':
+				view_fullscreen_toggle(vw, FALSE);
+				break;
+			case 'I': case 'i':
+				view_overlay_toggle(vw);
+				break;
+			case ']':
+				image_alter(imd, ALTER_ROTATE_90);
+				break;
+			case '[':
+				image_alter(imd, ALTER_ROTATE_90_CC);
+				break;
+			case GDK_Delete: case GDK_KP_Delete:
+				if (enable_delete_key)
+					{
+					file_util_delete(image_get_path(imd), NULL, imd->widget);
+					}
+				break;
+			case GDK_Escape:
+				if (vw->fs)
+					{
+					view_fullscreen_toggle(vw, TRUE);
+					}
+				else
+					{
+					gtk_widget_destroy(vw->window);
+					}
+				break;
+			case GDK_Menu:
+			case GDK_F10:
+				menu = view_popup_menu(vw);
+				gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
+					       view_window_menu_pos_cb, vw, 0, GDK_CURRENT_TIME);
+				break;
+			default:
+				stop_signal = FALSE;
+				break;
+			}
 		}
 
 	return stop_signal;
--- a/src/layout_image.c	Thu Oct 19 19:32:31 2006 +0000
+++ b/src/layout_image.c	Fri Oct 20 12:03:16 2006 +0000
@@ -99,138 +99,49 @@
 static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
 	LayoutWindow *lw = data;
-	gint stop_signal = FALSE;
+	gint stop_signal;
 	gint x = 0;
 	gint y = 0;
 
+	stop_signal = TRUE;
 	switch (event->keyval)
 		{
 		case GDK_Left: case GDK_KP_Left:
 			x -= 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Right: case GDK_KP_Right:
 			x += 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Up: case GDK_KP_Up:
 			y -= 1;
-			stop_signal = TRUE;
 			break;
 		case GDK_Down: case GDK_KP_Down:
 			y += 1;
-			stop_signal = TRUE;
+			break;
+		default:
+			stop_signal = FALSE;
 			break;
 		}
 
-	if ( !(event->state & GDK_CONTROL_MASK) )
-	    switch (event->keyval)
+	if (x != 0 || y!= 0)
 		{
-		case '+': case '=': case GDK_KP_Add:
-			layout_image_zoom_adjust(lw, get_zoom_increment());
-			break;
-		case '-': case GDK_KP_Subtract:
-			layout_image_zoom_adjust(lw, -get_zoom_increment());
-			break;
-		case 'X': case 'x': case GDK_KP_Multiply:
-			layout_image_zoom_set(lw, 0.0);
-			break;
-		case 'Z': case 'z': case GDK_KP_Divide:
-		case '1':
-			layout_image_zoom_set(lw, 1.0);
-			break;
-		case '2':
-			layout_image_zoom_set(lw, 2.0);
-			break;
-		case '3':
-			layout_image_zoom_set(lw, 3.0);
-			break;
-		case '4':
-			layout_image_zoom_set(lw, 4.0);
-			break;
-		case '7':
-			layout_image_zoom_set(lw, -4.0);
-			break;
-		case '8':
-			layout_image_zoom_set(lw, -3.0);
-			break;
-		case '9':
-			layout_image_zoom_set(lw, -2.0);
-			break;
-		case 'W': case 'w':
-			layout_image_zoom_set_fill_geometry(lw, FALSE);
-			break;
-		case 'H': case 'h':
-			layout_image_zoom_set_fill_geometry(lw, TRUE);
-			break;
-		case GDK_Page_Up: case GDK_KP_Page_Up:
-		case GDK_BackSpace:
-		case 'B': case 'b':
-			layout_image_prev(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Page_Down: case GDK_KP_Page_Down:
-		case GDK_space:
-		case 'N': case 'n':
-			layout_image_next(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Home: case GDK_KP_Home:
-			layout_image_first(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_End: case GDK_KP_End:
-			layout_image_last(lw);
-			stop_signal = TRUE;
-			break;
-		case ']':
-			layout_image_alter(lw, ALTER_ROTATE_90);
-			stop_signal = TRUE;
-			break;
-		case '[':
-			layout_image_alter(lw, ALTER_ROTATE_90_CC);
-			stop_signal = TRUE;
-			break;
-		case GDK_Delete: case GDK_KP_Delete:
-			if (enable_delete_key)
-				{
-				file_util_delete(layout_image_get_path(lw), NULL, widget);
-				stop_signal = TRUE;
-				}
-			break;
-		case GDK_Escape:
-			layout_image_full_screen_stop(lw);
-			stop_signal = TRUE;
-			break;
-		case 'R': case 'r':
-			if (!(event->state & GDK_SHIFT_MASK))
-				{
-				layout_refresh(lw);
-				}
-			break;
-		case 'S': case 's':
-			layout_image_slideshow_toggle(lw);
-			break;
-		case 'P': case 'p':
-			layout_image_slideshow_pause_toggle(lw);
-			break;
-		case 'F': case 'f':
-		case 'V': case 'v':
-			layout_image_full_screen_stop(lw);
-			break;
-		case GDK_Menu:
-		case GDK_F10:
-			layout_image_full_screen_menu_popup(lw);
-			stop_signal = TRUE;
-			break;
-		case 'I': case 'i':
-			layout_image_overlay_set(lw, !(lw->full_screen_overlay_on));
-			break;
+		if (event->state & GDK_SHIFT_MASK)
+			{
+			x *= 3;
+			y *= 3;
+			}
+
+		keyboard_scroll_calc(&x, &y, event);
+		layout_image_scroll(lw, x, y);
 		}
 
+	if (stop_signal) return stop_signal;
+
 	if (event->state & GDK_CONTROL_MASK)
 		{
 		gint n = -1;
+
+		stop_signal = TRUE;
 		switch (event->keyval)
 			{
 			case '1':
@@ -282,6 +193,9 @@
 				exit_gqview();
 				return FALSE;
 				break;
+			default:
+				stop_signal = FALSE;
+				break;
 			}
 		if (n != -1)
 			{
@@ -294,35 +208,123 @@
 		}
 	else if (event->state & GDK_SHIFT_MASK)
 		{
+		stop_signal = TRUE;
 		switch (event->keyval)
 			{
 			case 'R': case 'r':
 				layout_image_alter(lw, ALTER_ROTATE_180);
-				stop_signal = TRUE;
 				break;
 			case 'M': case 'm':
 				layout_image_alter(lw, ALTER_MIRROR);
-				stop_signal = TRUE;
 				break;
 			case 'F': case 'f':
 				layout_image_alter(lw, ALTER_FLIP);
-				stop_signal = TRUE;
 				break;
 			case 'G': case 'g':
 				layout_image_alter(lw, ALTER_DESATURATE);
-				stop_signal = TRUE;
 				break;
 			default:
+				stop_signal = FALSE;
 				break;
 			}
-		x *= 3;
-		y *= 3;
 		}
-
-	if (x != 0 || y!= 0)
+	else
 		{
-		keyboard_scroll_calc(&x, &y, event);
-		layout_image_scroll(lw, x, y);
+		stop_signal = TRUE;
+		switch (event->keyval)
+			{
+			case '+': case '=': case GDK_KP_Add:
+				layout_image_zoom_adjust(lw, get_zoom_increment());
+				break;
+			case '-': case GDK_KP_Subtract:
+				layout_image_zoom_adjust(lw, -get_zoom_increment());
+				break;
+			case 'X': case 'x': case GDK_KP_Multiply:
+				layout_image_zoom_set(lw, 0.0);
+				break;
+			case 'Z': case 'z': case GDK_KP_Divide:
+			case '1':
+				layout_image_zoom_set(lw, 1.0);
+				break;
+			case '2':
+				layout_image_zoom_set(lw, 2.0);
+				break;
+			case '3':
+				layout_image_zoom_set(lw, 3.0);
+				break;
+			case '4':
+				layout_image_zoom_set(lw, 4.0);
+				break;
+			case '7':
+				layout_image_zoom_set(lw, -4.0);
+				break;
+			case '8':
+				layout_image_zoom_set(lw, -3.0);
+				break;
+			case '9':
+				layout_image_zoom_set(lw, -2.0);
+				break;
+			case 'W': case 'w':
+				layout_image_zoom_set_fill_geometry(lw, FALSE);
+				break;
+			case 'H': case 'h':
+				layout_image_zoom_set_fill_geometry(lw, TRUE);
+				break;
+			case GDK_Page_Up: case GDK_KP_Page_Up:
+			case GDK_BackSpace:
+			case 'B': case 'b':
+				layout_image_prev(lw);
+				break;
+			case GDK_Page_Down: case GDK_KP_Page_Down:
+			case GDK_space:
+			case 'N': case 'n':
+				layout_image_next(lw);
+				break;
+			case GDK_Home: case GDK_KP_Home:
+				layout_image_first(lw);
+				break;
+			case GDK_End: case GDK_KP_End:
+				layout_image_last(lw);
+				break;
+			case ']':
+				layout_image_alter(lw, ALTER_ROTATE_90);
+				break;
+			case '[':
+				layout_image_alter(lw, ALTER_ROTATE_90_CC);
+				break;
+			case GDK_Delete: case GDK_KP_Delete:
+				if (enable_delete_key)
+					{
+					file_util_delete(layout_image_get_path(lw), NULL, widget);
+					}
+				break;
+			case GDK_Escape:
+				layout_image_full_screen_stop(lw);
+				break;
+			case 'R': case 'r':
+				layout_refresh(lw);
+				break;
+			case 'S': case 's':
+				layout_image_slideshow_toggle(lw);
+				break;
+			case 'P': case 'p':
+				layout_image_slideshow_pause_toggle(lw);
+				break;
+			case 'F': case 'f':
+			case 'V': case 'v':
+				layout_image_full_screen_stop(lw);
+				break;
+			case GDK_Menu:
+			case GDK_F10:
+				layout_image_full_screen_menu_popup(lw);
+				break;
+			case 'I': case 'i':
+				layout_image_overlay_set(lw, !(lw->full_screen_overlay_on));
+				break;
+			default:
+				stop_signal = FALSE;
+				break;
+			}
 		}
 
 	return stop_signal;
--- a/src/layout_util.c	Thu Oct 19 19:32:31 2006 +0000
+++ b/src/layout_util.c	Fri Oct 20 12:03:16 2006 +0000
@@ -103,142 +103,133 @@
 	if (lw->image &&
 	    (GTK_WIDGET_HAS_FOCUS(lw->image->widget) || (lw->tools && widget == lw->window)) )
 		{
+		stop_signal = TRUE;
 		switch (event->keyval)
 			{
 			case GDK_Left: case GDK_KP_Left:
 				x -= 1;
-				stop_signal = TRUE;
 				break;
 			case GDK_Right: case GDK_KP_Right:
 				x += 1;
-				stop_signal = TRUE;
 				break;
 			case GDK_Up: case GDK_KP_Up:
 				y -= 1;
-				stop_signal = TRUE;
 				break;
 			case GDK_Down: case GDK_KP_Down:
 				y += 1;
-				stop_signal = TRUE;
 				break;
 			case GDK_BackSpace:
 			case 'B': case 'b':
 				layout_image_prev(lw);
-				stop_signal = TRUE;
 				break;
 			case GDK_space:
 			case 'N': case 'n':
 				layout_image_next(lw);
-				stop_signal = TRUE;
 				break;
 			case GDK_Menu:
 				layout_image_menu_popup(lw);
-				stop_signal = TRUE;
+				break;
+			default:
+				stop_signal = FALSE;
 				break;
 			}
 		}
 
-	if (!stop_signal && !(event->state & GDK_CONTROL_MASK) )
-	    switch (event->keyval)
-		{
-		case '+': case GDK_KP_Add:
-			layout_image_zoom_adjust(lw, get_zoom_increment());
-			stop_signal = TRUE;
-			break;
-		case GDK_KP_Subtract:
-			layout_image_zoom_adjust(lw, -get_zoom_increment());
-			stop_signal = TRUE;
-			break;
-		case GDK_KP_Multiply:
-			layout_image_zoom_set(lw, 0.0);
-			stop_signal = TRUE;
-			break;
-		case GDK_KP_Divide:
-		case '1':
-			layout_image_zoom_set(lw, 1.0);
-			stop_signal = TRUE;
-			break;
-		case '2':
-			layout_image_zoom_set(lw, 2.0);
-			stop_signal = TRUE;
-			break;
-		case '3':
-			layout_image_zoom_set(lw, 3.0);
-			stop_signal = TRUE;
-			break;
-		case '4':
-			layout_image_zoom_set(lw, 4.0);
-			stop_signal = TRUE;
-			break;
-		case '7':
-			layout_image_zoom_set(lw, -4.0);
-			stop_signal = TRUE;
-			break;
-		case '8':
-			layout_image_zoom_set(lw, -3.0);
-			stop_signal = TRUE;
-			break;
-		case '9':
-			layout_image_zoom_set(lw, -2.0);
-			stop_signal = TRUE;
-			break;
-		case 'W': case 'w':
-			layout_image_zoom_set_fill_geometry(lw, FALSE);
-			break;
-		case 'H': case 'h':
-			layout_image_zoom_set_fill_geometry(lw, TRUE);
-			break;
-		case GDK_Page_Up: case GDK_KP_Page_Up:
-			layout_image_prev(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Page_Down: case GDK_KP_Page_Down:
-			layout_image_next(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Home: case GDK_KP_Home:
-			layout_image_first(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_End: case GDK_KP_End:
-			layout_image_last(lw);
-			stop_signal = TRUE;
-			break;
-		case GDK_Delete: case GDK_KP_Delete:
-			if (enable_delete_key)
-				{
-				file_util_delete(NULL, layout_selection_list(lw), widget);
-				stop_signal = TRUE;
-				}
-			break;
-		case GDK_Escape:
-			/* FIXME:interrupting thumbs no longer allowed */
-#if 0
-			interrupt_thumbs();
-#endif
-			stop_signal = TRUE;
-			break;
-		case 'P': case 'p':
-			layout_image_slideshow_pause_toggle(lw);
-			break;
-		case 'V': case 'v':
-			if (!(event->state & GDK_MOD1_MASK)) layout_image_full_screen_toggle(lw);
-			break;
-		}
-
-	if (event->state & GDK_SHIFT_MASK)
-		{
-		x *= 3;
-		y *= 3;
-		}
-
 	if (x != 0 || y!= 0)
 		{
+		if (event->state & GDK_SHIFT_MASK)
+			{
+			x *= 3;
+			y *= 3;
+			}
+
 		keyboard_scroll_calc(&x, &y, event);
 		layout_image_scroll(lw, x, y);
 		}
 
+	if (stop_signal) return stop_signal;
+
+	if (!(event->state & GDK_CONTROL_MASK))
+		{
+		stop_signal = TRUE;
+		switch (event->keyval)
+			{
+			case '+': case GDK_KP_Add:
+				layout_image_zoom_adjust(lw, get_zoom_increment());
+				break;
+			case GDK_KP_Subtract:
+				layout_image_zoom_adjust(lw, -get_zoom_increment());
+				break;
+			case GDK_KP_Multiply:
+				layout_image_zoom_set(lw, 0.0);
+				break;
+			case GDK_KP_Divide:
+			case '1':
+				layout_image_zoom_set(lw, 1.0);
+				break;
+			case '2':
+				layout_image_zoom_set(lw, 2.0);
+				break;
+			case '3':
+				layout_image_zoom_set(lw, 3.0);
+				break;
+			case '4':
+				layout_image_zoom_set(lw, 4.0);
+				break;
+			case '7':
+				layout_image_zoom_set(lw, -4.0);
+				break;
+			case '8':
+				layout_image_zoom_set(lw, -3.0);
+				break;
+			case '9':
+				layout_image_zoom_set(lw, -2.0);
+				break;
+			case 'W': case 'w':
+				layout_image_zoom_set_fill_geometry(lw, FALSE);
+				break;
+			case 'H': case 'h':
+				layout_image_zoom_set_fill_geometry(lw, TRUE);
+				break;
+			case GDK_Page_Up: case GDK_KP_Page_Up:
+				layout_image_prev(lw);
+				break;
+			case GDK_Page_Down: case GDK_KP_Page_Down:
+				layout_image_next(lw);
+				break;
+			case GDK_Home: case GDK_KP_Home:
+				layout_image_first(lw);
+				break;
+			case GDK_End: case GDK_KP_End:
+				layout_image_last(lw);
+				break;
+			case GDK_Delete: case GDK_KP_Delete:
+				if (enable_delete_key)
+					{
+					file_util_delete(NULL, layout_selection_list(lw), widget);
+					}
+				break;
+			case GDK_Escape:
+				/* FIXME:interrupting thumbs no longer allowed */
+#if 0
+				interrupt_thumbs();
+#endif
+				break;
+			case 'P': case 'p':
+				layout_image_slideshow_pause_toggle(lw);
+				break;
+			case 'V': case 'v':
+				if (!(event->state & GDK_MOD1_MASK)) layout_image_full_screen_toggle(lw);
+				break;
+			default:
+				stop_signal = FALSE;
+				break;
+			}
+		}
+
+#if 0
 	if (stop_signal) g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event");
+#endif
 
 	return stop_signal;
 }