In <1078646274.3425.26.camel@linux.local>
"Re: chinese support glitches?" on Sun, 07 Mar 2004 08:57:54 +0100,
Lars Clausen <lars@raeder.dk> wrote:
> This patch breaks the ability to use Ctrl-arrowkey to scroll around the
> diagram while editing, or Ctrl-{kp+,kp-} to zoom in and out while
> editing. Not good.
What about this?
--
kou
Index: app/disp_callbacks.c
===================================================================
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.74
diff -u -p -r1.74 disp_callbacks.c
--- app/disp_callbacks.c 18 Feb 2004 14:35:21 -0000 1.74
+++ app/disp_callbacks.c 7 Mar 2004 08:25:06 -0000
@@ -641,78 +641,76 @@ ddisplay_canvas_events (GtkWidget *canva
kevent = (GdkEventKey *)event;
state = kevent->state;
key_handled = FALSE;
-
- focus = active_focus();
- if ((focus != NULL) &&
- !(state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) ) {
+ return_val = TRUE;
+
+ switch(kevent->keyval) {
+ case GDK_Up:
+ ddisplay_scroll_up(ddisp);
+ ddisplay_flush(ddisp);
+ break;
+ case GDK_Down:
+ ddisplay_scroll_down(ddisp);
+ ddisplay_flush(ddisp);
+ break;
+ case GDK_Left:
+ ddisplay_scroll_left(ddisp);
+ ddisplay_flush(ddisp);
+ break;
+ case GDK_Right:
+ ddisplay_scroll_right(ddisp);
+ ddisplay_flush(ddisp);
+ break;
+ case GDK_KP_Add:
+ case GDK_plus:
+ visible = &ddisp->visible;
+ middle.x = visible->left*0.5 + visible->right*0.5;
+ middle.y = visible->top*0.5 + visible->bottom*0.5;
+
+ ddisplay_zoom(ddisp, &middle, M_SQRT2);
+ break;
+ case GDK_KP_Subtract:
+ case GDK_minus:
+ visible = &ddisp->visible;
+ middle.x = visible->left*0.5 + visible->right*0.5;
+ middle.y = visible->top*0.5 + visible->bottom*0.5;
+
+ ddisplay_zoom(ddisp, &middle, M_SQRT1_2);
+ break;
+ case GDK_Shift_L:
+ case GDK_Shift_R:
+ if (active_tool->type == MAGNIFY_TOOL)
+ set_zoom_out(active_tool);
+ break;
+ default:
+ if (kevent->string && 0 == strcmp(" ",kevent->string)) {
+ tool_select_former();
+ } else {
+ focus = active_focus();
+ if (focus != NULL) {
/* Keys goes to the active focus. */
- obj = focus->obj;
- if (diagram_is_selected(ddisp->diagram, obj)) {
-
- if (!gtk_im_context_filter_keypress(
+ obj = focus->obj;
+ if (diagram_is_selected(ddisp->diagram, obj)) {
+
+ if (!gtk_im_context_filter_keypress(
GTK_IM_CONTEXT(ddisp->im_context), kevent)) {
/*! key event not swallowed by the input method ? */
- handle_key_event(ddisp, focus, kevent->keyval,
- kevent->string, kevent->length);
+ handle_key_event(ddisp, focus, kevent->keyval,
+ kevent->string, kevent->length);
- diagram_flush(ddisp->diagram);
+ diagram_flush(ddisp->diagram);
+ }
+ }
+ return_val = key_handled = TRUE;
+ } else {
+ return_val = FALSE;
}
}
- return_val = key_handled = TRUE;
}
- if (!key_handled) {
- /* No focus to receive keys, take care of it ourselves. */
- return_val = TRUE;
+ if (!key_handled)
gtk_im_context_reset(GTK_IM_CONTEXT(ddisp->im_context));
-
- switch(kevent->keyval) {
- case GDK_Up:
- ddisplay_scroll_up(ddisp);
- ddisplay_flush(ddisp);
- break;
- case GDK_Down:
- ddisplay_scroll_down(ddisp);
- ddisplay_flush(ddisp);
- break;
- case GDK_Left:
- ddisplay_scroll_left(ddisp);
- ddisplay_flush(ddisp);
- break;
- case GDK_Right:
- ddisplay_scroll_right(ddisp);
- ddisplay_flush(ddisp);
- break;
- case GDK_KP_Add:
- case GDK_plus:
- visible = &ddisp->visible;
- middle.x = visible->left*0.5 + visible->right*0.5;
- middle.y = visible->top*0.5 + visible->bottom*0.5;
-
- ddisplay_zoom(ddisp, &middle, M_SQRT2);
- break;
- case GDK_KP_Subtract:
- case GDK_minus:
- visible = &ddisp->visible;
- middle.x = visible->left*0.5 + visible->right*0.5;
- middle.y = visible->top*0.5 + visible->bottom*0.5;
-
- ddisplay_zoom(ddisp, &middle, M_SQRT1_2);
- break;
- case GDK_Shift_L:
- case GDK_Shift_R:
- if (active_tool->type == MAGNIFY_TOOL)
- set_zoom_out(active_tool);
- break;
- default:
- if (kevent->string && 0 == strcmp(" ",kevent->string)) {
- tool_select_former();
- } else {
- return_val = FALSE;
- }
- }
- }
+
break;
case GDK_KEY_RELEASE: