Mercurial > geeqie.yaz
comparison src/image-overlay.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 | 5f49f305a6b6 |
children | 7f91f906f9c2 |
comparison
equal
deleted
inserted
replaced
1522:d7206703d90f | 1523:24a12aa0cb54 |
---|---|
49 gint y; | 49 gint y; |
50 | 50 |
51 gint icon_time[IMAGE_OSD_COUNT]; | 51 gint icon_time[IMAGE_OSD_COUNT]; |
52 gint icon_id[IMAGE_OSD_COUNT]; | 52 gint icon_id[IMAGE_OSD_COUNT]; |
53 | 53 |
54 gint idle_id; | 54 guint idle_id; /* event source id */ |
55 gint timer_id; | 55 guint timer_id; /* event source id */ |
56 gulong destroy_id; | 56 gulong destroy_id; |
57 }; | 57 }; |
58 | 58 |
59 | 59 |
60 typedef struct _OSDIcon OSDIcon; | 60 typedef struct _OSDIcon OSDIcon; |
888 image_osd_icons_hide(osd); | 888 image_osd_icons_hide(osd); |
889 } | 889 } |
890 | 890 |
891 osd->changed_states = IMAGE_STATE_NONE; | 891 osd->changed_states = IMAGE_STATE_NONE; |
892 osd->notify = 0; | 892 osd->notify = 0; |
893 osd->idle_id = -1; | 893 osd->idle_id = 0; |
894 return FALSE; | 894 return FALSE; |
895 } | 895 } |
896 | 896 |
897 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) | 897 static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) |
898 { | 898 { |
899 if (force) osd->changed_states |= IMAGE_STATE_IMAGE; | 899 if (force) osd->changed_states |= IMAGE_STATE_IMAGE; |
900 | 900 |
901 if (osd->idle_id == -1) | 901 if (!osd->idle_id) |
902 { | 902 { |
903 osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL); | 903 osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL); |
904 } | 904 } |
905 } | 905 } |
906 | 906 |
939 | 939 |
940 if (changed) image_osd_update_schedule(osd, FALSE); | 940 if (changed) image_osd_update_schedule(osd, FALSE); |
941 | 941 |
942 if (done) | 942 if (done) |
943 { | 943 { |
944 osd->timer_id = -1; | 944 osd->timer_id = 0; |
945 return FALSE; | 945 return FALSE; |
946 } | 946 } |
947 | 947 |
948 return TRUE; | 948 return TRUE; |
949 } | 949 } |
950 | 950 |
951 static void image_osd_timer_schedule(OverlayStateData *osd) | 951 static void image_osd_timer_schedule(OverlayStateData *osd) |
952 { | 952 { |
953 if (osd->timer_id == -1) | 953 if (!osd->timer_id) |
954 { | 954 { |
955 osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd); | 955 osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
979 | 979 |
980 static void image_osd_free(OverlayStateData *osd) | 980 static void image_osd_free(OverlayStateData *osd) |
981 { | 981 { |
982 if (!osd) return; | 982 if (!osd) return; |
983 | 983 |
984 if (osd->idle_id != -1) g_source_remove(osd->idle_id); | 984 if (osd->idle_id) g_source_remove(osd->idle_id); |
985 if (osd->timer_id != -1) g_source_remove(osd->timer_id); | 985 if (osd->timer_id) g_source_remove(osd->timer_id); |
986 | 986 |
987 file_data_unregister_notify_func(image_osd_notify_cb, osd); | 987 file_data_unregister_notify_func(image_osd_notify_cb, osd); |
988 | 988 |
989 if (osd->imd) | 989 if (osd->imd) |
990 { | 990 { |
1023 | 1023 |
1024 if (!osd) | 1024 if (!osd) |
1025 { | 1025 { |
1026 osd = g_new0(OverlayStateData, 1); | 1026 osd = g_new0(OverlayStateData, 1); |
1027 osd->imd = imd; | 1027 osd->imd = imd; |
1028 osd->idle_id = -1; | |
1029 osd->timer_id = -1; | |
1030 osd->show = OSD_SHOW_NOTHING; | 1028 osd->show = OSD_SHOW_NOTHING; |
1031 osd->x = options->image_overlay.x; | 1029 osd->x = options->image_overlay.x; |
1032 osd->y = options->image_overlay.y; | 1030 osd->y = options->image_overlay.y; |
1033 | 1031 |
1034 osd->histogram = histogram_new(); | 1032 osd->histogram = histogram_new(); |