Mercurial > geeqie.yaz
diff src/fullscreen.c @ 1523:24a12aa0cb54
Fix up event source ids type: gint -> guint.
Functions like g_timeout_add() or g_idle_add() return a guint
greater than 0, but in most places it was wrongly stored as int
and initialized to -1.
This broke assertions matching in g_source_remove() for example
since id was always greater than 0 even when timer was not set
(-1 was casted to the biggest guint).
author | zas_ |
---|---|
date | Mon, 06 Apr 2009 22:13:54 +0000 |
parents | a3d3208b0c50 |
children | fee96b7345e8 |
line wrap: on
line diff
--- a/src/fullscreen.c Mon Apr 06 21:52:49 2009 +0000 +++ b/src/fullscreen.c Mon Apr 06 22:13:54 2009 +0000 @@ -74,21 +74,22 @@ { FullScreenData *fs = data; - if (fs->hide_mouse_id == -1) return FALSE; + if (!fs->hide_mouse_id) return FALSE; fs->cursor_state &= ~FULLSCREEN_CURSOR_NORMAL; if (!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY)) clear_mouse_cursor(fs->window, fs->cursor_state); - fs->hide_mouse_id = -1; + g_source_remove(fs->hide_mouse_id); + fs->hide_mouse_id = 0; return FALSE; } static void fullscreen_hide_mouse_disable(FullScreenData *fs) { - if (fs->hide_mouse_id != -1) + if (fs->hide_mouse_id) { g_source_remove(fs->hide_mouse_id); - fs->hide_mouse_id = -1; + fs->hide_mouse_id = 0; } } @@ -114,10 +115,10 @@ static void fullscreen_busy_mouse_disable(FullScreenData *fs) { - if (fs->busy_mouse_id != -1) + if (fs->busy_mouse_id) { g_source_remove(fs->busy_mouse_id); - fs->busy_mouse_id = -1; + fs->busy_mouse_id = 0; } } @@ -143,14 +144,14 @@ { FullScreenData *fs = data; - fs->busy_mouse_id = -1; + fs->busy_mouse_id = 0; fullscreen_mouse_set_busy(fs, TRUE); return FALSE; } static void fullscreen_mouse_set_busy_idle(FullScreenData *fs) { - if (fs->busy_mouse_id == -1) + if (!fs->busy_mouse_id) { fs->busy_mouse_id = g_timeout_add(FULL_SCREEN_BUSY_MOUSE_DELAY, fullscreen_mouse_set_busy_cb, fs); @@ -227,8 +228,6 @@ fs = g_new0(FullScreenData, 1); - fs->hide_mouse_id = -1; - fs->busy_mouse_id = -1; fs->cursor_state = FULLSCREEN_CURSOR_HIDDEN; fs->normal_window = window; @@ -335,7 +334,7 @@ { if (!fs) return; - g_source_remove(fs->saver_block_id); + if (fs->saver_block_id) g_source_remove(fs->saver_block_id); fullscreen_hide_mouse_disable(fs); fullscreen_busy_mouse_disable(fs);