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

gEDA-cvs: pcb.git: branch: master updated (575ef7e0e185e7eefb55a0b771012c9caea2992b)



The branch, master has been updated
       via  575ef7e0e185e7eefb55a0b771012c9caea2992b (commit)
      from  c85fd7cfa63f6a89cb8b9a03dd0002ffdb613729 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid.h                 |    1 +
 src/hid/batch/batch.c     |    7 +++++++
 src/hid/bom/bom.c         |    1 +
 src/hid/common/extents.c  |    1 +
 src/hid/common/hidnogui.c |    9 +++++++++
 src/hid/gerber/gerber.c   |    1 +
 src/hid/gtk/gtkhid-main.c |   19 +++++++++++++++++++
 src/hid/gtk/gui.h         |    1 +
 src/hid/lesstif/main.c    |   30 ++++++++++++++++++++++++++++++
 src/hid/lpr/lpr.c         |    1 +
 src/hid/nelma/nelma.c     |    1 +
 src/hid/png/png.c         |    1 +
 src/hid/ps/eps.c          |    1 +
 src/hid/ps/ps.c           |    1 +
 14 files changed, 75 insertions(+), 0 deletions(-)


=================
 Commit Messages
=================

commit 575ef7e0e185e7eefb55a0b771012c9caea2992b
Author: Steven Michalske <smichalske@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Adding the ability to use mod1 (alt)(option) in HIDs
    
    This is useful for OSX installs as crtl-click, is mapped to right click.
    so when drawing a line that you want to force a DRC "Violation" and you need
    to use the control key, it will cancel the line being drawn, and start a
    new point.
    
    This is tested in the lesstif and GTK hids, under OSX wher ehte option
    key is the "alt" key.   I leave it to the patch integrator th verify on
    linux for GTK and lesstif.
    
    This is a bit hackish on detecting the alt key/option key, I #ifdefed it
    to __APPLE__ because the option key returns 1<<13 not GDK_MOD1_MASK
    Under lesstif I might guess that the alt/mod1 is not quite the same as
    option.

:100644 100644 3efb9ed... 15185f1... M	src/hid.h
:100644 100644 5479b46... 171926b... M	src/hid/batch/batch.c
:100644 100644 9892269... 08d4328... M	src/hid/bom/bom.c
:100644 100644 60a7174... bf53c14... M	src/hid/common/extents.c
:100644 100644 5c33332... 4d6baa0... M	src/hid/common/hidnogui.c
:100644 100644 ee2a0ec... e68026d... M	src/hid/gerber/gerber.c
:100644 100644 769f36b... 0156559... M	src/hid/gtk/gtkhid-main.c
:100644 100644 17093ac... ca56361... M	src/hid/gtk/gui.h
:100644 100644 66dfb66... d58202e... M	src/hid/lesstif/main.c
:100644 100644 31d288e... cf35d8b... M	src/hid/lpr/lpr.c
:100644 100644 b186345... ee3a896... M	src/hid/nelma/nelma.c
:100644 100644 4c97913... 8dbff71... M	src/hid/png/png.c
:100644 100644 ef00c52... 2115b47... M	src/hid/ps/eps.c
:100644 100644 85e013f... fdbf7ac... M	src/hid/ps/ps.c

=========
 Changes
=========

commit 575ef7e0e185e7eefb55a0b771012c9caea2992b
Author: Steven Michalske <smichalske@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Adding the ability to use mod1 (alt)(option) in HIDs
    
    This is useful for OSX installs as crtl-click, is mapped to right click.
    so when drawing a line that you want to force a DRC "Violation" and you need
    to use the control key, it will cancel the line being drawn, and start a
    new point.
    
    This is tested in the lesstif and GTK hids, under OSX wher ehte option
    key is the "alt" key.   I leave it to the patch integrator th verify on
    linux for GTK and lesstif.
    
    This is a bit hackish on detecting the alt key/option key, I #ifdefed it
    to __APPLE__ because the option key returns 1<<13 not GDK_MOD1_MASK
    Under lesstif I might guess that the alt/mod1 is not quite the same as
    option.

diff --git a/src/hid.h b/src/hid.h
index 3efb9ed..15185f1 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -408,6 +408,7 @@ typedef enum
     /* Temporary */
     int (*shift_is_pressed) (void);
     int (*control_is_pressed) (void);
+	int (*mod1_is_pressed) (void);
     void (*get_coords) (const char *msg_, int *x_, int *y_);
 
     /* Sets the crosshair, which may differ from the pointer depending
diff --git a/src/hid/batch/batch.c b/src/hid/batch/batch.c
index 5479b46..171926b 100644
--- a/src/hid/batch/batch.c
+++ b/src/hid/batch/batch.c
@@ -315,6 +315,12 @@ batch_control_is_pressed (void)
   return 0;
 }
 
+static int
+batch_mod1_is_pressed (void)
+{
+  return 0;
+}
+
 static void
 batch_get_coords (const char *msg, int *x, int *y)
 {
@@ -489,6 +495,7 @@ HID batch_gui = {
   batch_calibrate,
   batch_shift_is_pressed,
   batch_control_is_pressed,
+  batch_mod1_is_pressed,
   batch_get_coords,
   batch_set_crosshair,
   batch_add_timer,
diff --git a/src/hid/bom/bom.c b/src/hid/bom/bom.c
index 9892269..08d4328 100644
--- a/src/hid/bom/bom.c
+++ b/src/hid/bom/bom.c
@@ -568,6 +568,7 @@ HID bom_hid = {
   0,				/* bom_calibrate */
   0,				/* bom_shift_is_pressed */
   0,				/* bom_control_is_pressed */
+  0,				/* bom_mod1_is_pressed */
   0,				/* bom_get_coords */
   0,				/* bom_set_crosshair */
   0,				/* bom_add_timer */
diff --git a/src/hid/common/extents.c b/src/hid/common/extents.c
index 60a7174..bf53c14 100644
--- a/src/hid/common/extents.c
+++ b/src/hid/common/extents.c
@@ -210,6 +210,7 @@ static HID extents_hid = {
   0 /* extents_calibrate */ ,
   0 /* extents_shift_is_pressed */ ,
   0 /* extents_control_is_pressed */ ,
+  0 /* extents_mod1_is_pressed */ ,
   0 /* extents_get_coords */ ,
   0 /* extents_set_crosshair */ ,
   0 /* extents_add_timer */ ,
diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index 5c33332..4d6baa0 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -190,6 +190,13 @@ nogui_control_is_pressed (void)
   return 0;
 }
 
+static int
+nogui_mod1_is_pressed (void)
+{
+  CRASH;
+  return 0;
+}
+
 static void
 nogui_get_coords (const char *msg, int *x, int *y)
 {
@@ -376,6 +383,7 @@ HID hid_nogui = {
   nogui_calibrate,
   nogui_shift_is_pressed,
   nogui_control_is_pressed,
+  nogui_mod1_is_pressed,
   nogui_get_coords,
   nogui_set_crosshair,
   nogui_add_timer,
@@ -429,6 +437,7 @@ apply_default_hid (HID * d, HID * s)
   AD (calibrate);
   AD (shift_is_pressed);
   AD (control_is_pressed);
+  AD (mod1_is_pressed);
   AD (get_coords);
   AD (set_crosshair);
   AD (add_timer);
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index ee2a0ec..e68026d 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -1103,6 +1103,7 @@ static HID gerber_hid = {
   gerber_calibrate,
   0 /* gerber_shift_is_pressed */ ,
   0 /* gerber_control_is_pressed */ ,
+  0 /* gerber_mod1_is_pressed */ ,
   0 /* gerber_get_coords */ ,
   gerber_set_crosshair,
   0 /* gerber_add_timer */ ,
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 769f36b..0156559 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1064,6 +1064,23 @@ ghid_control_is_pressed ()
   return (mask & GDK_CONTROL_MASK) ? TRUE : FALSE;
 }
 
+int
+ghid_mod1_is_pressed ()
+{
+  GdkModifierType mask;
+  GHidPort *out = &ghid_port;
+
+  if( ! ghid_gui_is_up )
+    return 0;
+
+  gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+#ifdef __APPLE__
+  return (mask & ( 1 << 13 ) ) ? TRUE : FALSE;  // The option key is not MOD1, although it should be...
+#else
+  return (mask & GDK_MOD1_MASK) ? TRUE : FALSE;
+#endif
+}
+
 void
 ghid_set_crosshair (int x, int y, int action)
 {
@@ -1513,6 +1530,7 @@ HID ghid_hid = {
   ghid_calibrate,
   ghid_shift_is_pressed,
   ghid_control_is_pressed,
+  ghid_mod1_is_pressed,
   ghid_get_coords,
   ghid_set_crosshair,
   ghid_add_timer,
@@ -1576,6 +1594,7 @@ HID ghid_extents = {
   0 /* ghid_calibrate */ ,
   0 /* ghid_shift_is_pressed */ ,
   0 /* ghid_control_is_pressed */ ,
+  0 /* ghid_mod1_is_pressed */ ,
   0 /* ghid_get_coords */ ,
   0 /* ghid_set_crosshair */ ,
   0 /* ghid_add_timer */ ,
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 17093ac..ca56361 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -412,6 +412,7 @@ ModifierKeysState ghid_modifier_keys_state (GdkModifierType * state);
 ButtonState ghid_button_state (GdkModifierType * state);
 gboolean ghid_is_modifier_key_sym (gint ksym);
 gboolean ghid_control_is_pressed (void);
+gboolean ghid_mod1_is_pressed (void);
 gboolean ghid_shift_is_pressed (void);
 
 void ghid_draw_area_update (GHidPort * out, GdkRectangle * rect);
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 66dfb66..d58202e 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -1233,6 +1233,7 @@ zoom_by (double factor, int x, int y)
 static int panning = 0;
 static int shift_pressed;
 static int ctrl_pressed;
+static int alt_pressed;
 
 /* X and Y are in screen coordinates.  */
 static void
@@ -1295,7 +1296,16 @@ mod_changed (XKeyEvent * e, int set)
     case XK_Control_R:
       ctrl_pressed = set;
       break;
+#ifdef __APPLE__
+	case XK_Mode_switch:
+#else
+	case XK_Alt_L:
+	case XK_Alt_R:
+#endif
+	  alt_pressed = set;
+	  break;
     default:
+	  // to include the Apple keyboard left and right command keys use XK_Meta_L and XK_Meta_R respectivly.
       return;
     }
   in_move_event = 1;
@@ -1344,7 +1354,11 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
         pressed_button = e->xbutton.button;
         mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0)
           + ((e->xbutton.state & ControlMask) ? M_Ctrl : 0)
+#ifdef __APPLE__
+          + ((e->xbutton.state & (1<<13)) ? M_Alt : 0);
+#else
           + ((e->xbutton.state & Mod1Mask) ? M_Alt : 0);
+#endif
         do_mouse_action(e->xbutton.button, mods);
         RestoreCrosshair (True);
         break;
@@ -1360,7 +1374,11 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
         pressed_button = 0;
         mods = ((e->xbutton.state & ShiftMask) ? M_Shift : 0)
           + ((e->xbutton.state & ControlMask) ? M_Ctrl : 0)
+#ifdef __APPLE__
+          + ((e->xbutton.state & (1<<13)) ? M_Alt : 0)
+#else
           + ((e->xbutton.state & Mod1Mask) ? M_Alt : 0)
+#endif
           + M_Release;
         do_mouse_action (e->xbutton.button, mods);
         RestoreCrosshair (True);
@@ -1377,6 +1395,11 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
 		       &root_x, &root_y, &pos_x, &pos_y, &keys_buttons);
 	shift_pressed = (keys_buttons & ShiftMask);
 	ctrl_pressed = (keys_buttons & ControlMask);
+#ifdef __APPLE__
+	alt_pressed = (keys_buttons & (1<<13));
+#else
+	alt_pressed = (keys_buttons & Mod1Mask);
+#endif
 	/*printf("m %d %d\n", Px(e->xmotion.x), Py(e->xmotion.y)); */
 	crosshair_in_window = 1;
 	in_move_event = 1;
@@ -3329,6 +3352,12 @@ lesstif_control_is_pressed (void)
   return ctrl_pressed;
 }
 
+static int
+lesstif_mod1_is_pressed (void)
+{
+  return alt_pressed;
+}
+
 extern void lesstif_get_coords (const char *msg, int *x, int *y);
 
 static void
@@ -3749,6 +3778,7 @@ HID lesstif_gui = {
   lesstif_calibrate,
   lesstif_shift_is_pressed,
   lesstif_control_is_pressed,
+  lesstif_mod1_is_pressed,
   lesstif_get_coords,
   lesstif_set_crosshair,
   lesstif_add_timer,
diff --git a/src/hid/lpr/lpr.c b/src/hid/lpr/lpr.c
index 31d288e..cf35d8b 100644
--- a/src/hid/lpr/lpr.c
+++ b/src/hid/lpr/lpr.c
@@ -145,6 +145,7 @@ HID lpr_hid = {
   lpr_calibrate,
   0 /* lpr_shift_is_pressed */ ,
   0 /* lpr_control_is_pressed */ ,
+  0 /* lpr_mod1_is_pressed */ ,
   0 /* lpr_get_coords */ ,
   0 /* lpr_set_crosshair */ ,
   0 /* lpr_add_timer */ ,
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index b186345..ee3a896 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -1080,6 +1080,7 @@ HID             nelma_hid = {
 	nelma_calibrate,
 	0 /* nelma_shift_is_pressed */ ,
 	0 /* nelma_control_is_pressed */ ,
+	0 /* nelma_mod1_is_pressed */ ,
 	0 /* nelma_get_coords */ ,
 	nelma_set_crosshair,
 	0 /* nelma_add_timer */ ,
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index 4c97913..8dbff71 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -1354,6 +1354,7 @@ HID png_hid = {
   png_calibrate,
   0 /* png_shift_is_pressed */ ,
   0 /* png_control_is_pressed */ ,
+  0 /* png_mod1_is_pressed */ ,
   0 /* png_get_coords */ ,
   png_set_crosshair,
   0 /* png_add_timer */ ,
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index ef00c52..2115b47 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -643,6 +643,7 @@ static HID eps_hid = {
   eps_calibrate,
   0 /* eps_shift_is_pressed */ ,
   0 /* eps_control_is_pressed */ ,
+  0 /* eps_mod1_is_pressed */ ,
   0 /* eps_get_coords */ ,
   eps_set_crosshair,
   0 /* eps_add_timer */ ,
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 85e013f..fdbf7ac 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -1181,6 +1181,7 @@ HID ps_hid = {
   ps_calibrate,
   0 /* ps_shift_is_pressed */ ,
   0 /* ps_control_is_pressed */ ,
+  0 /* ps_mod1_is_pressed */ ,
   0 /* ps_get_coords */ ,
   ps_set_crosshair,
   0 /* ps_add_timer */ ,




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs