[gromit: 11/13] * gromit.c: - Tweaked various messages to give better error reporting - Detect Xinerama and avoid a
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gromit: 11/13] * gromit.c: - Tweaked various messages to give better error reporting - Detect Xinerama and avoid a
- Date: Tue, 16 Mar 2010 22:24:23 +0000 (UTC)
commit d21c255bc3c8d732cf16059b6c23efbb3f848f2b
Author: Simon Budig <simon budig de>
Date: Tue Dec 6 22:06:00 2005 +0100
* gromit.c: - Tweaked various messages to give better error reporting
- Detect Xinerama and avoid a GDK-Bug that returned wrong coordinates.
* gromit.1: Added/Extended manpage for gromit, started by Pierre
Chiffilier <chifflier cpe fr>. Thanks!
Import of gromit history
ChangeLog | 8 ++++
Makefile | 2 +-
README | 2 +-
gromit.1 | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
gromit.c | 34 ++++++++++++-------
5 files changed, 138 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fcc8721..7072bc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-04-12 Simon Budig <simon gimp org>
+
+ * gromit.c: - Tweaked various messages to give better error reporting
+ - Detect Xinerama and avoid a GDK-Bug that returned wrong coordinates.
+
+ * gromit.1: Added/Extended manpage for gromit, started by Pierre
+ Chiffilier <chifflier cpe fr>. Thanks!
+
2004-12-13 Simon Budig <simon gimp org>
* gromit.c: - Make activation on startup possible (gromit -a)
diff --git a/Makefile b/Makefile
index 05cf11d..8ff8e64 100644
--- a/Makefile
+++ b/Makefile
@@ -7,4 +7,4 @@ propertywatch: propertywatch.c
gcc -o propertywatch propertywatch.c `gtk-config --libs --cflags`
gromit: gromit.c Makefile
- gcc -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE -o gromit gromit.c -Wall `pkg-config --libs --cflags gtk+-2.0`
+ gcc -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE -o gromit gromit.c -Wall -Wno-pointer-sign `pkg-config --libs --cflags gtk+-2.0`
diff --git a/README b/README
index d40af19..565050b 100644
--- a/README
+++ b/README
@@ -92,7 +92,7 @@ You can also draw lines that end in an arrow head. For this you
have to specify "arrowsize". This is a factor relative to the width
of the line. For reasonable arrowheads start with 1.
- "blue Pen" = "blue Arrow" (arrowsize=2);
+ "blue Arrow" = "blue Pen" (arrowsize=2);
An "ERASER" is a tool that erases the drawings on screen.
The color parameter is not important.
diff --git a/gromit.1 b/gromit.1
new file mode 100644
index 0000000..0cacfce
--- /dev/null
+++ b/gromit.1
@@ -0,0 +1,107 @@
+.\" Hey, vim: ft=nroff
+.TH GROMIT 1 "January 16, 2005"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+Gromit \- Presentation helper to make annotations on screen
+.SH SYNOPSIS
+.B gromit
+.RI [ options ]
+.br
+.SH DESCRIPTION
+\fBGromit\fP enables you to make annotations on your screen. It can run in
+the background and be activated on demand to let you draw over all your
+currently running applications. The drawing will stay on screen as long as you
+want, you can continue to use your applications while the drawing is visible.
+.br
+\fBGromit\fP is XInput-Aware, so if you have a graphic tablet you can
+draw lines with different strength, color, erase things, etc.
+.br
+Since you typically want to use the program you are demonstrating and
+highlighting something is a short interruption of you workflow,
+Gromit is activated by either a hotkey or a repeated invokation of Gromit
+(the latter can e.g. used by other applications or your windowmanager).
+.br
+.SH KEYBOARD CONTROL
+By default, Gromit grabs the "Pause" key (this can be change using the
+"--key" option), making it unavailable to other application. The
+available shortcuts are:
+.TP
+.B Pause
+toggle painting
+.TP
+.B SHIFT-Pause
+clear screen
+.TP
+.B CTRL-Pause
+toggle visibility
+.TP
+.B ALT-Pause
+quit Gromit
+.PP
+.SH OPTIONS (STARTUP)
+A short summary of the available commandline arguments for invoking Gromit, see
+below for the options to control an already running Gromit process:
+.TP
+.B \-a, \-\-active
+start Gromit and immediately activate it.
+.TP
+.B \-k <keysym>, \-\-key <keysym>
+will change the key used to grab the mouse. <keysym> can e.g. be
+"Pause", "F12", "Control_R" or "Print". To determine the keysym for
+different keys you can use the \fBxev\fP(1) command. You can specify "none"
+to prevent Gromit from grabbing a key.
+.TP
+.B \-K <keycode>, \-\-keycode <keycode>
+will change the key used to grab the mouse. Under rare circumstances
+identifying the key with the keysym can fail. You can then use the keycode
+to specify the key uniquely. To determine the keycode for different keys you
+can use the \fBxev\fP(1) command.
+.TP
+.B \-d, \-\-debug
+gives some debug output.
+.SH OPTIONS (CONTROL)
+A sort summary of the available commandline arguments to control an already
+running Gromit process, see above for the options available to start Gromit.
+.TP
+.B \-q, \-\-quit
+will cause the main Gromit process to quit.
+.TP
+.B \-t, \-\-toggle
+will toggle the grabbing of the cursor.
+.TP
+.B \-v, \-\-visibility
+will toggle the visibility of the window.
+.TP
+.B \-c, \-\-clear
+will clear the screen.
+.SH BUGS
+Gromit may drastically slow down your X-Server, especially when you draw
+very thin lines. It makes heavily use of the shape extension, which is
+quite expensive if you paint a complex pattern on screen. Especially
+terminal-programs tend to scroll incredibly slow if something is painted
+over their window. There is nothing I can do about this.
+.br
+Gromit partially disables DnD, since it lays a transparent window across
+the whole screen and everything gets "dropped" to this (invisible)
+window. Gromit tries to minimize this effect: When you clear the screen
+the shaped window will be hidden. It will be resurrected, when you want
+to paint something again. However: The window does not hide, if you
+erase everything with the eraser tool, you have to clear the screen
+explicitely with the "gromit --clear" command or hide Gromit with
+"gromit --visibility".
+.SH AUTHOR
+Simon Budig <simon gimp org>
+.PP
+This manual page was written by Pierre Chifflier <chifflier cpe fr> and
+Simon Budig.
diff --git a/gromit.c b/gromit.c
index 83e4b1d..01d12c7 100644
--- a/gromit.c
+++ b/gromit.c
@@ -93,6 +93,7 @@ typedef struct
GdkPixmap *pixmap;
GdkDisplay *display;
GdkScreen *screen;
+ gboolean xinerama;
GdkWindow *root;
gchar *hot_keyval;
guint hot_keycode;
@@ -455,7 +456,7 @@ gromit_select_tool (GromitData *data, GdkDevice *device, guint state)
guint req_buttons = 0, req_modifier = 0;
guint i, j, success = 0;
GromitPaintContext *context = NULL;
- guchar *name;
+ gchar *name;
if (device)
{
@@ -731,7 +732,7 @@ paintto (GtkWidget *win,
&coords, &nevents);
/* g_printerr ("Got %d coords\n", nevents); */
- if (coords)
+ if (!data->xinerama && nevents > 0)
{
for (i=0; i < nevents; i++)
{
@@ -1043,9 +1044,17 @@ parse_config (GromitData *data)
if (file < 0)
{
- g_printerr ("Could not open %s: %s\n", filename, g_strerror (errno));
+ /* try global config file */
g_free (filename);
- return;
+ filename = g_strdup ("/etc/gromit/gromitrc");
+ file = open (filename, O_RDONLY);
+
+ if (file < 0)
+ {
+ g_printerr ("Could not open %s: %s\n", filename, g_strerror (errno));
+ g_free (filename);
+ return;
+ }
}
scanner = g_scanner_new (NULL);
@@ -1306,6 +1315,7 @@ setup_client_app (GromitData *data)
{
data->display = gdk_display_get_default ();
data->screen = gdk_display_get_default_screen (data->display);
+ data->xinerama = gdk_screen_get_n_monitors (data->screen) > 1;
data->root = gdk_screen_get_root_window (data->screen);
data->width = gdk_screen_get_width (data->screen);
data->height = gdk_screen_get_height (data->screen);
@@ -1394,9 +1404,9 @@ setup_main_app (GromitData *data, gboolean activate)
gtk_widget_set_events (data->area, GROMIT_PAINT_AREA_EVENTS);
gtk_signal_connect (GTK_OBJECT (data->area), "expose_event",
- (GtkSignalFunc) event_expose, (gpointer) data);
+ GTK_SIGNAL_FUNC (event_expose), (gpointer) data);
gtk_signal_connect (GTK_OBJECT (data->area),"configure_event",
- (GtkSignalFunc) event_configure, (gpointer) data);
+ GTK_SIGNAL_FUNC (event_configure), (gpointer) data);
gtk_signal_connect (GTK_OBJECT (data->win), "motion_notify_event",
GTK_SIGNAL_FUNC (paintto), (gpointer) data);
gtk_signal_connect (GTK_OBJECT (data->win), "button_press_event",
@@ -1455,7 +1465,6 @@ setup_main_app (GromitData *data, gboolean activate)
if (data->hot_keyval)
{
- GdkKeymap *keymap;
GdkKeymapKey *keys;
gint n_keys;
guint keyval;
@@ -1463,10 +1472,9 @@ setup_main_app (GromitData *data, gboolean activate)
if (strlen (data->hot_keyval) > 0 &&
strcasecmp (data->hot_keyval, "none") != 0)
{
- keymap = gdk_keymap_get_for_display (data->display);
keyval = gdk_keyval_from_name (data->hot_keyval);
- if (!keyval || !gdk_keymap_get_entries_for_keyval (keymap, keyval,
+ if (!keyval || !gdk_keymap_get_entries_for_keyval (NULL, keyval,
&keys, &n_keys))
{
g_printerr ("cannot find the key \"%s\"\n", data->hot_keyval);
@@ -1579,7 +1587,7 @@ app_parse_args (int argc, char **argv, GromitData *data)
}
else
{
- g_printerr ("Unknown Option: \"%s\"\n", arg);
+ g_printerr ("Unknown Option for Gromit startup: \"%s\"\n", arg);
wrong_arg = TRUE;
}
@@ -1594,7 +1602,7 @@ app_parse_args (int argc, char **argv, GromitData *data)
}
else
{
- g_printerr ("Please see the Gromit README for the correct usage\n");
+ g_printerr ("Please see the Gromit manpage for the correct usage\n");
exit (1);
}
}
@@ -1641,7 +1649,7 @@ main_client (int argc, char **argv, GromitData *data)
}
else
{
- g_printerr ("Unknown Option: \"%s\"\n", arg);
+ g_printerr ("Unknown Option to control a running Gromit process: \"%s\"\n", arg);
wrong_arg = TRUE;
}
@@ -1653,7 +1661,7 @@ main_client (int argc, char **argv, GromitData *data)
}
else
{
- g_printerr ("Please see the Gromit README for the correct usage\n");
+ g_printerr ("Please see the Gromit manpage for the correct usage\n");
return 1;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]