[gnome-panel/wip/free-the-fish: 8/10] free-the-fish.c: Move the code to activate the hide mode into separate function
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/free-the-fish: 8/10] free-the-fish.c: Move the code to activate the hide mode into separate function
- Date: Tue, 2 Jun 2015 21:35:32 +0000 (UTC)
commit 118173772d78de575fecfc2fa3d410636d77dbd5
Author: Sebastian Geiger <sbastig gmx net>
Date: Tue Jun 2 23:21:29 2015 +0200
free-the-fish.c: Move the code to activate the hide mode into separate function
gnome-panel/free-the-fish.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/gnome-panel/free-the-fish.c b/gnome-panel/free-the-fish.c
index d7680ca..422806b 100644
--- a/gnome-panel/free-the-fish.c
+++ b/gnome-panel/free-the-fish.c
@@ -133,6 +133,24 @@ fish_move (gpointer data)
}
static void
+fish_start_hide_mode (void)
+{
+ g_source_remove (fish.handler);
+ fish.handler = g_timeout_add (FISH_HIDE_TIMEOUT,
+ fish_move, NULL);
+ fish.x_speed *= FISH_XS_HIDE_FACTOR;
+ fish.y_speed *= FISH_YS_HIDE_FACTOR;
+ fish.hide_mode = TRUE;
+ if (fish.x_speed > 0) {
+ if (fish.x < (gdk_screen_width () / 2))
+ fish.x_speed *= -1;
+ } else {
+ if (fish.x > (gdk_screen_width () / 2))
+ fish.x_speed *= -1;
+ }
+}
+
+static void
fish_handle_event (GdkEvent *event)
{
if (event->any.window != fish.window)
@@ -146,19 +164,7 @@ fish_handle_event (GdkEvent *event)
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
- g_source_remove (fish.handler);
- fish.handler = g_timeout_add (FISH_HIDE_TIMEOUT,
- fish_move, NULL);
- fish.xs *= FISH_XS_HIDE_FACTOR;
- fish.ys *= FISH_YS_HIDE_FACTOR;
- fish.hide_mode = TRUE;
- if (fish.xs > 0) {
- if (fish.x < (gdk_screen_width () / 2))
- fish.xs *= -1;
- } else {
- if (fish.x > (gdk_screen_width () / 2))
- fish.xs *= -1;
- }
+ fish_start_hide_mode ();
break;
default:
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]