diff -Nru cellwriter-1.3.4/configure cellwriter-1.3.4.16/configure --- cellwriter-1.3.4/configure 2008-01-25 19:34:51.000000000 +0000 +++ cellwriter-1.3.4.16/configure 2008-08-21 20:08:52.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for CellWriter 1.3.4. +# Generated by GNU Autoconf 2.61 for CellWriter 1.3.5. # # Report bugs to . # @@ -574,8 +574,8 @@ # Identity of this package. PACKAGE_NAME='CellWriter' PACKAGE_TARNAME='cellwriter' -PACKAGE_VERSION='1.3.4' -PACKAGE_STRING='CellWriter 1.3.4' +PACKAGE_VERSION='1.3.5' +PACKAGE_STRING='CellWriter 1.3.5' PACKAGE_BUGREPORT='risujin@risujin.org' ac_unique_file="src/main.c" @@ -1223,7 +1223,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures CellWriter 1.3.4 to adapt to many kinds of systems. +\`configure' configures CellWriter 1.3.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1293,7 +1293,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of CellWriter 1.3.4:";; + short | recursive ) echo "Configuration of CellWriter 1.3.5:";; esac cat <<\_ACEOF @@ -1393,7 +1393,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -CellWriter configure 1.3.4 +CellWriter configure 1.3.5 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1407,7 +1407,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by CellWriter $as_me 1.3.4, which was +It was created by CellWriter $as_me 1.3.5, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2097,7 +2097,7 @@ # Define the identity of the package. PACKAGE='cellwriter' - VERSION='1.3.4' + VERSION='1.3.5' cat >>confdefs.h <<_ACEOF @@ -6372,7 +6372,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by CellWriter $as_me 1.3.4, which was +This file was extended by CellWriter $as_me 1.3.5, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6425,7 +6425,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -CellWriter config.status 1.3.4 +CellWriter config.status 1.3.5 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -Nru cellwriter-1.3.4/configure.ac cellwriter-1.3.4.16/configure.ac --- cellwriter-1.3.4/configure.ac 2008-01-25 19:33:50.000000000 +0000 +++ cellwriter-1.3.4.16/configure.ac 2008-08-21 20:08:52.000000000 +0000 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([CellWriter], [1.3.4], [risujin@risujin.org]) +AC_INIT([CellWriter], [1.3.5], [risujin@risujin.org]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADER([config.h]) diff -Nru cellwriter-1.3.4/debian/changelog cellwriter-1.3.4.16/debian/changelog --- cellwriter-1.3.4/debian/changelog 2010-09-15 05:36:47.000000000 +0000 +++ cellwriter-1.3.4.16/debian/changelog 2010-09-15 05:36:47.000000000 +0000 @@ -1,3 +1,15 @@ +cellwriter (1.3.4.16-0ubuntu1~thjaeger2) maverick; urgency=low + + * Update to maverick + + -- Thomas Jaeger Wed, 15 Sep 2010 01:32:51 -0400 + +cellwriter (1.3.4.16-0ubuntu1~thjaeger1) lucid; urgency=low + + * New svn snapshot + + -- Thomas Jaeger Tue, 13 Apr 2010 03:31:35 -0400 + cellwriter (1.3.4-1ubuntu1) intrepid; urgency=low * Added depends on librsvg2-common (Fixes LP: #254604). diff -Nru cellwriter-1.3.4/src/cellwidget.c cellwriter-1.3.4.16/src/cellwidget.c --- cellwriter-1.3.4/src/cellwidget.c 2008-01-24 20:41:14.000000000 +0000 +++ cellwriter-1.3.4.16/src/cellwidget.c 2008-08-21 20:08:52.000000000 +0000 @@ -1785,9 +1785,7 @@ is_clear = TRUE; } - /* Only re-render when we aren't going to get a configure event */ - if (!resized) - cell_widget_render(); + cell_widget_render(); } void cell_widget_train(void) diff -Nru cellwriter-1.3.4/src/keyevent.c cellwriter-1.3.4.16/src/keyevent.c --- cellwriter-1.3.4/src/keyevent.c 2007-11-27 20:08:07.000000000 +0000 +++ cellwriter-1.3.4.16/src/keyevent.c 2009-04-27 06:47:08.000000000 +0000 @@ -235,20 +235,6 @@ type_keycode(ke_num_lock.keycode); } -static int is_modifier(unsigned int keysym) -/* Returns TRUE for KeySyms that are tracked internally */ -{ - switch (keysym) { - case XK_Shift_L: - case XK_Shift_R: - case XK_Num_Lock: - case XK_Caps_Lock: - return TRUE; - default: - return FALSE; - } -} - static void key_event_allocate(KeyEvent *key_event, unsigned int keysym) /* Either finds the KeyCode associated with the given keysym or overwrites a usable one to generate it */ @@ -324,11 +310,9 @@ } void key_event_new(KeyEvent *key_event, unsigned int keysym) -/* Filters locks and shifts but allocates other keys normally */ +/* Allocates key event */ { key_event->keysym = keysym; - if (is_modifier(keysym)) - return; key_event_allocate(key_event, keysym); } @@ -342,22 +326,9 @@ key_event->keysym = 0; } -void key_event_press(KeyEvent *key_event) -/* Press the KeyCode specified in the event */ +void key_event_press_force(KeyEvent *key_event) +/* Press the KeyCode specified in the event without sticky key tracking */ { - /* Track modifiers without actually using them */ - if (key_event->keysym == XK_Shift_L || - key_event->keysym == XK_Shift_R) { - key_shifted++; - return; - } else if (key_event->keysym == XK_Caps_Lock) { - key_caps_locked = !key_caps_locked; - return; - } else if (key_event->keysym == XK_Num_Lock) { - key_num_locked = !key_num_locked; - return; - } - /* Invalid event */ if (key_event->keycode < key_min || key_event->keycode > key_max) return; @@ -378,15 +349,28 @@ XSync(GDK_DISPLAY(), False); } -void key_event_release(KeyEvent *key_event) +void key_event_press(KeyEvent *key_event) +/* Press the KeyCode specified in the event */ { /* Track modifiers without actually using them */ if (key_event->keysym == XK_Shift_L || key_event->keysym == XK_Shift_R) { - key_shifted--; + key_shifted++; + return; + } else if (key_event->keysym == XK_Caps_Lock) { + key_caps_locked = !key_caps_locked; + return; + } else if (key_event->keysym == XK_Num_Lock) { + key_num_locked = !key_num_locked; return; } + key_event_press_force(key_event); +} + +void key_event_release_force(KeyEvent *key_event) +/* Press the KeyCode specified in the event without sticky key tracking */ +{ /* Invalid key event */ if (key_event->keycode < key_min || key_event->keycode > key_max) return; @@ -401,6 +385,19 @@ XSync(GDK_DISPLAY(), False); } +void key_event_release(KeyEvent *key_event) +/* Release the KeyCode specified in the event */ +{ + /* Track modifiers without actually using them */ + if (key_event->keysym == XK_Shift_L || + key_event->keysym == XK_Shift_R) { + key_shifted--; + return; + } + + key_event_release_force(key_event); +} + #ifdef X_HAVE_UTF8_STRING void key_event_send_char(int unichar) { diff -Nru cellwriter-1.3.4/src/keys.h cellwriter-1.3.4.16/src/keys.h --- cellwriter-1.3.4/src/keys.h 2007-11-27 20:03:06.000000000 +0000 +++ cellwriter-1.3.4.16/src/keys.h 2009-04-27 06:47:08.000000000 +0000 @@ -34,7 +34,9 @@ void key_event_new(KeyEvent *key_event, unsigned int keysym); void key_event_free(KeyEvent *key_event); void key_event_press(KeyEvent *key_event); +void key_event_press_force(KeyEvent *key_event); void key_event_release(KeyEvent *key_event); +void key_event_release_force(KeyEvent *key_event); void key_event_send_char(int unichar); void key_event_send_enter(void); void key_event_update_mappings(void); diff -Nru cellwriter-1.3.4/src/keywidget.c cellwriter-1.3.4.16/src/keywidget.c --- cellwriter-1.3.4/src/keywidget.c 2008-01-24 19:09:46.000000000 +0000 +++ cellwriter-1.3.4.16/src/keywidget.c 2009-04-27 06:47:08.000000000 +0000 @@ -438,6 +438,17 @@ key_widget->min_height / key_widget->y_range / 2); + /* Enable leave/notify signals */ + if (key_widget->drawing_area->window) { + GdkEventMask mask; + + mask = gdk_window_get_events(key_widget->drawing_area->window); + gdk_window_set_events(key_widget->drawing_area->window, mask | + GDK_ENTER_NOTIFY_MASK | + GDK_LEAVE_NOTIFY_MASK); + } else + g_warning("Failed to get GdkWindow for KeyWidget"); + key_widget_update_colors(); key_widget_render(key_widget); return TRUE; @@ -503,6 +514,7 @@ key_event_new(&sticky_key->key_event, keysym); key_event_press(&sticky_key->key_event); } else { + key_event_new(&sticky_key->key_event, keysym); key_event_release(&sticky_key->key_event); key_event_free(&sticky_key->key_event); sticky_key->active = FALSE; @@ -513,6 +525,35 @@ update_shifted(key_widget); } +static gboolean notify_event(GtkWidget *widget, GdkEventCrossing *event, + KeyWidget *key_widget) +/* Press or release modifier keys depending on pointer location */ +{ + int i; + + for (i = 0; i < key_widget->len; i++) { + Key *sticky_key = key_widget->keys + i; + int keysym; + + if (!(sticky_key->flags & KEY_STICKY) || !sticky_key->active) + continue; + keysym = sticky_key->keysym; + if (is_shifted(sticky_key)) + keysym = sticky_key->keysym_shift; + if (!keysym) + continue; + if (event->type == GDK_LEAVE_NOTIFY) { + key_event_new(&sticky_key->key_event, keysym); + key_event_press_force(&sticky_key->key_event); + } else { + key_event_new(&sticky_key->key_event, keysym); + key_event_release_force(&sticky_key->key_event); + key_event_free(&sticky_key->key_event); + } + } + return FALSE; +} + gboolean key_widget_button_press(GtkWidget *widget, GdkEventButton *event, KeyWidget *key_widget) /* Mouse button is pressed over drawing area */ @@ -554,6 +595,7 @@ key_event_new(&key->key_event, keysym); key_event_press(&key->key_event); } else { + key_event_new(&key->key_event, keysym); key_event_release(&key->key_event); key_event_free(&key->key_event); } @@ -575,6 +617,12 @@ Key *key; int old_shifted; + /* Did we miss a keypress due to a server grab? */ + if (key_widget->active < 0) { + event->type = GDK_BUTTON_PRESS; + key_widget_button_press(widget, event, key_widget); + } + /* The last pressed key is the one we are releasing now */ if (key_widget->active < 0 || key_widget->active > key_widget->len) return FALSE; @@ -925,8 +973,12 @@ G_CALLBACK(key_widget_button_press), key_widget); g_signal_connect(G_OBJECT(drawing_area), "button_release_event", G_CALLBACK(key_widget_button_release), key_widget); - g_signal_connect(G_OBJECT(drawing_area), "style-set", + g_signal_connect(G_OBJECT(drawing_area), "style_set", G_CALLBACK(style_set), key_widget); + g_signal_connect(G_OBJECT(drawing_area), "enter_notify_event", + G_CALLBACK(notify_event), key_widget); + g_signal_connect(G_OBJECT(drawing_area), "leave_notify_event", + G_CALLBACK(notify_event), key_widget); gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); diff -Nru cellwriter-1.3.4/src/main.c cellwriter-1.3.4.16/src/main.c --- cellwriter-1.3.4/src/main.c 2008-01-25 19:38:39.000000000 +0000 +++ cellwriter-1.3.4.16/src/main.c 2009-05-13 01:07:38.000000000 +0000 @@ -618,6 +618,7 @@ static char *log_filename = NULL; static FILE *log_file = NULL; +static int ignore_fifo; /* Profile commands table */ static struct { @@ -662,6 +663,8 @@ "Do not save changes to the profile", NULL }, { "disable-overwrite", 0, 0, G_OPTION_ARG_NONE, &key_disable_overwrite, "Do not modify the keymap", NULL }, + { "ignore-fifo", 0, 0, G_OPTION_ARG_NONE, &ignore_fifo, + "Allow starting a second instance", NULL }, /* Sentinel */ { NULL, 0, 0, 0, NULL, NULL, NULL } @@ -836,7 +839,7 @@ window_hide(); else if (str[0] == '1' || str[0] == 'S' || str[0] == 's') window_show(); - else if (str[0] == 'T' || str[0] == 't') + else if (str[0] == '2' || str[0] == 'T' || str[0] == 't') window_toggle(); } @@ -866,12 +869,20 @@ /* See if the program is already running */ g_message("Starting " PACKAGE_STRING); create_user_dir(); - if (!window_embedded && - single_instance_init((SingleInstanceFunc)second_instance, - window_force_hide ? "0" : "1")) { - gdk_notify_startup_complete(); - g_message(PACKAGE_NAME " already running, quitting"); - return 0; + if (!window_embedded && !ignore_fifo) { + const char *msg; + + msg = "2"; + if (window_force_show) + msg = "1"; + else if (window_force_hide) + msg = "0"; + if (single_instance_init((SingleInstanceFunc)second_instance, + msg)) { + gdk_notify_startup_complete(); + g_message(PACKAGE_NAME " already running, quitting"); + return 0; + } } #ifdef HAVE_GNOME diff -Nru cellwriter-1.3.4/src/singleinstance.c cellwriter-1.3.4.16/src/singleinstance.c --- cellwriter-1.3.4/src/singleinstance.c 2007-10-28 01:41:32.000000000 +0000 +++ cellwriter-1.3.4.16/src/singleinstance.c 2008-09-28 06:28:06.000000000 +0000 @@ -30,40 +30,55 @@ Single-instance checks */ +static GIOChannel *io_channel; static SingleInstanceFunc on_dupe; -static int fifo; static char *path; -static gboolean check_dupe(void) +void single_instance_cleanup(void) { + if (io_channel) { + g_io_channel_unref(io_channel); + io_channel = NULL; + } + if (path && unlink(path) == -1) + log_errno("Failed to unlink program FIFO"); +} + +static gboolean on_fifo_input(GIOChannel *src, GIOCondition cond, gpointer data) +{ + GError *error; ssize_t len; + gsize bytes_read; char buf[2]; - if (fifo <= 0 || !on_dupe) + if (!io_channel || !on_dupe) return FALSE; - len = read(fifo, buf, 1); + error = NULL; + len = g_io_channel_read_chars(io_channel, buf, 1, &bytes_read, &error); + + /* Error reading for some reason */ + if (error) { + single_instance_cleanup(); + return FALSE; + } + + /* Handle the one-byte message */ buf[1] = 0; if (len > 0) on_dupe(buf); return TRUE; } -void single_instance_cleanup(void) -{ - if (fifo > 0) - close(fifo); - if (path && unlink(path) == -1) - log_errno("Failed to unlink program FIFO"); -} - int single_instance_init(SingleInstanceFunc func, const char *str) { + int fifo; + on_dupe = func; path = g_build_filename(g_get_home_dir(), "." PACKAGE, "fifo", NULL); /* If we can open the program FIFO in write-only mode then we must - have a reader process already running. We send it a one-byte junk - message to wake it up and quit. */ + have a reader process already running. We send it a one-byte + message and quit. */ if ((fifo = open(path, O_WRONLY | O_NONBLOCK)) > 0) { write(fifo, str, 1); close(fifo); @@ -78,21 +93,19 @@ single_instance_cleanup(); } - /* Otherwise, create a read-only FIFO and poll for input */ - fifo = 0; + /* Otherwise, create a read-only FIFO */ if (mkfifo(path, S_IRUSR | S_IWUSR)) { log_errno("Failed to create program FIFO"); return FALSE; } - if ((fifo = open(path, O_RDONLY | O_NONBLOCK)) == -1) { + if ((fifo = open(path, O_RDWR | O_NONBLOCK)) == -1) { log_errno("Failed to open FIFO for reading"); return FALSE; } - /* Setup the polling function */ - g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, 1000, - (GSourceFunc)check_dupe, NULL, NULL); - + /* Open and watch the fifo to become readable */ + io_channel = g_io_channel_unix_new(fifo); + g_io_add_watch(io_channel, G_IO_IN, on_fifo_input, NULL); return FALSE; } diff -Nru cellwriter-1.3.4/src/window.c cellwriter-1.3.4.16/src/window.c --- cellwriter-1.3.4/src/window.c 2007-11-27 20:22:11.000000000 +0000 +++ cellwriter-1.3.4.16/src/window.c 2009-04-27 06:47:08.000000000 +0000 @@ -28,6 +28,11 @@ #include #include +/* Enable this option if your window manager support window gravity. With this + option, the CellWriter window will resize from the bottom using the + window manager rather than manually. */ +/* #define WINDOW_GRAVITY */ + /* options.c */ void options_dialog_open(void); @@ -189,17 +194,15 @@ GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE); trace("%dx%d", geometry.min_width, geometry.min_height); +#ifdef WINDOW_GRAVITY /* In some bright and sunny alternate universe when specifications are actually implemented as inteded, this function alone would cause the window frame to expand upwards without having to perform the ugly - hack in window_configure(). XFWM4 does not respect this hint and - setting this hint will further mess up the window_configure() - movement code. */ - /*geometry.win_gravity = window_docked == WINDOW_DOCKED_TOP ? - GDK_GRAVITY_NORTH_WEST : - GDK_GRAVITY_SOUTH_WEST; + hack in window_configure(). */ + geometry.win_gravity = GDK_GRAVITY_SOUTH_WEST; gtk_window_set_geometry_hints(GTK_WINDOW(window), window, &geometry, - GDK_HINT_WIN_GRAVITY);*/ + GDK_HINT_WIN_GRAVITY); +#endif } static void docked_move_resize(void) @@ -266,6 +269,7 @@ return FALSE; } +#ifndef WINDOW_GRAVITY /* Keep the window aligned to the bottom border */ if (height_change && window_frame.y + window_frame.height / 2 > gdk_screen_get_height(screen) / 2) @@ -299,6 +303,7 @@ trace("moving to (%d, %d)", window_frame.x, window_frame.y); } else window_frame = new_frame; +#endif return FALSE; } Binary files /tmp/SZGKQ_PR1z/cellwriter-1.3.4/test/test and /tmp/k8303xDpQy/cellwriter-1.3.4.16/test/test differ