[gnome-control-center/gnome-3-4] wacom: Cancel calibration if window loses focus
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-4] wacom: Cancel calibration if window loses focus
- Date: Thu, 14 Jun 2012 17:12:43 +0000 (UTC)
commit 4183b637c208003ed359954b111da4347b4add65
Author: Olivier Fourdan <ofourdan redhat com>
Date: Thu May 3 14:04:20 2012 +0200
wacom: Cancel calibration if window loses focus
Make the calibrator window stay above other windows and cancel
calibration if/when the calibrator loses input focus.
https://bugzilla.gnome.org/show_bug.cgi?id=675354
panels/wacom/calibrator/gui_gtk.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/panels/wacom/calibrator/gui_gtk.c b/panels/wacom/calibrator/gui_gtk.c
index d37b43f..16bde10 100644
--- a/panels/wacom/calibrator/gui_gtk.c
+++ b/panels/wacom/calibrator/gui_gtk.c
@@ -301,6 +301,17 @@ on_key_release_event(GtkWidget *widget,
}
static gboolean
+on_focus_out_event (GtkWidget *widget,
+ GdkEvent *event,
+ CalibArea *area)
+{
+ /* If the calibrator window looses focus, simply bail out... */
+ on_delete_event (widget, NULL, area);
+
+ return FALSE;
+}
+
+static gboolean
on_timer_signal(CalibArea *area)
{
GdkWindow *win;
@@ -388,6 +399,7 @@ calib_area_new (GdkScreen *screen,
gtk_widget_add_events (calib_area->window, GDK_KEY_RELEASE_MASK | GDK_BUTTON_PRESS_MASK);
gtk_widget_set_can_focus (calib_area->window, TRUE);
gtk_window_fullscreen (GTK_WINDOW (calib_area->window));
+ gtk_window_set_keep_above (GTK_WINDOW (calib_area->window), TRUE);
/* Connect callbacks */
g_signal_connect (calib_area->window, "draw",
@@ -398,6 +410,8 @@ calib_area_new (GdkScreen *screen,
G_CALLBACK(on_key_release_event), calib_area);
g_signal_connect (calib_area->window, "delete-event",
G_CALLBACK(on_delete_event), calib_area);
+ g_signal_connect (calib_area->window, "focus-out-event",
+ G_CALLBACK(on_focus_out_event), calib_area);
/* Setup timer for animation */
calib_area->anim_id = g_timeout_add(TIME_STEP, (GSourceFunc)on_timer_signal, calib_area);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]