Change website address to www.geda-project.org.
[geda-xgsch2pcb.git] / support / pcb.window_raise_actions.patch
blob69a012361db7bc8db430551a76842a556d2f43b0
1 Index: gtk/gui-top-window.c
2 ===================================================================
3 RCS file: /cvsroot/pcb/pcb/src/hid/gtk/gui-top-window.c,v
4 retrieving revision 1.34
5 diff -U3 -p -r1.34 gui-top-window.c
6 --- gtk/gui-top-window.c 19 Oct 2006 22:42:56 -0000 1.34
7 +++ gtk/gui-top-window.c 2 Dec 2006 13:54:14 -0000
8 @@ -84,6 +84,9 @@
9 #include <dmalloc.h>
10 #endif
12 +// TODO: Does the GTK HID ASSUME X11?
13 +#include <gdk/gdkx.h> // For gdk_x11_window_set_user_time ()
15 RCSID ("$Id$");
17 extern HID ghid_hid;
18 @@ -3861,8 +3864,65 @@ LayersChanged (int argc, char **argv, in
19 return 0;
22 +static const char window_set_wm_time_syntax[] =
23 +"WindowSetWMTime ( timestamp )";
25 +static const char window_set_wm_time_help[] =
26 +"Sets the _WM_USER_TIME property on the main window. The timestamp should "
27 +"be a valid X11 Timestamp representing the last user interaction with the "
28 +"app. This action allows a project manager (or other app) to forward this "
29 +"Timestamp when requesting PCB raise above its own window.";
31 +/* %start-doc actions WindowSetWMTime
33 +This action is used to set the _WM_USER_TIME property to allow raising
34 +of the window with some window managers.
36 +%end-doc */
38 +static int
39 +WindowSetWMTime (int argc, char **argv, int x, int y)
41 + long timestamp_long;
43 + if (argc != 1)
44 + {
45 + fprintf( stderr, "Need one argument" );
46 + return 0;
47 + }
48 + timestamp_long = atol( argv[0] );
50 + gdk_x11_window_set_user_time( GTK_WIDGET (gport->top_window)->window,
51 + timestamp_long );
52 + return 0;
56 +static const char window_raise_syntax[] =
57 +"WindowRaise ( )";
59 +static const char window_raise_help[] =
60 +"Raises the main window.";
62 +/* %start-doc actions WindowRaise
64 +This action is used to raise PCB's main window
66 +%end-doc */
68 +static int
69 +WindowRaise (int argc, char **argv, int x, int y)
71 + gdk_window_raise(GTK_WIDGET (gport->top_window)->window );
72 + return 0;
75 HID_Action gtk_topwindow_action_list[] = {
76 - {"LayersChanged", 0, LayersChanged}
77 + {"LayersChanged", 0, LayersChanged},
78 + {"WindowSetWMTime", 0, WindowSetWMTime,
79 + window_set_wm_time_help, window_set_wm_time_syntax},
80 + {"WindowRaise", 0, WindowRaise,
81 + window_raise_help, window_raise_syntax}
84 REGISTER_ACTIONS (gtk_topwindow_action_list)
85 Index: lesstif/main.c
86 ===================================================================
87 RCS file: /cvsroot/pcb/pcb/src/hid/lesstif/main.c,v
88 retrieving revision 1.38
89 diff -U3 -p -r1.38 main.c
90 --- lesstif/main.c 10 Oct 2006 10:49:58 -0000 1.38
91 +++ lesstif/main.c 2 Dec 2006 13:54:15 -0000
92 @@ -812,6 +814,62 @@ Benchmark (int argc, char **argv, int x,
93 return 0;
96 +static const char window_set_wm_time_syntax[] =
97 +"WindowSetWMTime ( timestamp )";
99 +static const char window_set_wm_time_help[] =
100 +"Sets the _WM_USER_TIME property on the main window. The timestamp should "
101 +"be a valid X11 Timestamp representing the last user interaction with the "
102 +"app. This action allows a project manager (or other app) to forward this "
103 +"Timestamp when requesting PCB raise above its own window.";
105 +/* %start-doc actions WindowSetWMTime
107 +This action is used to set the _WM_USER_TIME property to allow raising
108 +of the window with some window managers.
110 +%end-doc */
112 +static int
113 +WindowSetWMTime (int argc, char **argv, int x, int y)
115 + long timestamp_long;
117 + if (argc != 1)
119 + fprintf( stderr, "Need one argument" );
120 + return 0;
122 + timestamp_long = atol( argv[0] );
124 + XChangeProperty (display, XtWindow( appwidget ),
125 + XInternAtom( display, "_NET_WM_USER_TIME", 0),
126 + XA_CARDINAL, 32, PropModeReplace,
127 + (unsigned char *)&timestamp_long, 1);
129 + return 0;
133 +static const char window_raise_syntax[] =
134 +"WindowRaise ( )";
136 +static const char window_raise_help[] =
137 +"Raises the main window.";
139 +/* %start-doc actions WindowRaise
141 +This action is used to raise PCB's main window
143 +%end-doc */
145 +static int
146 +WindowRaise (int argc, char **argv, int x, int y)
148 + XRaiseWindow( display, XtWindow( appwidget ));
149 + return 0;
152 HID_Action lesstif_main_action_list[] = {
153 {"PCBChanged", 0, PCBChanged,
154 pcbchanged_help, pcbchanged_syntax},
155 @@ -830,7 +888,11 @@ HID_Action lesstif_main_action_list[] =
156 {"Command", 0, Command,
157 command_help, command_syntax},
158 {"Benchmark", 0, Benchmark,
159 - benchmark_help, benchmark_syntax}
160 + benchmark_help, benchmark_syntax},
161 + {"WindowSetWMTime", 0, WindowSetWMTime,
162 + window_set_wm_time_help, window_set_wm_time_syntax},
163 + {"WindowRaise", 0, WindowRaise,
164 + window_raise_help, window_raise_syntax}
167 REGISTER_ACTIONS (lesstif_main_action_list)