Mercurial > pidgin.yaz
comparison pidgin/pidgintooltip.c @ 31637:f2e0b8f38e14
propagate from branch 'im.pidgin.pidgin' (head 69fbc32fd3dfe8ca0979e1c486c3d51eb06088cf)
to branch 'im.pidgin.pidgin.openq' (head 0a02249008d0dad085b600dd65c45a347d1c84aa)
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Sun, 07 Nov 2010 04:48:56 +0000 |
parents | 21277e69e06c |
children | a8cc50c2279f |
comparison
equal
deleted
inserted
replaced
31636:35224e759210 | 31637:f2e0b8f38e14 |
---|---|
117 const char *name; | 117 const char *name; |
118 GtkWidget *tipwindow; | 118 GtkWidget *tipwindow; |
119 | 119 |
120 tipwindow = gtk_window_new(GTK_WINDOW_POPUP); | 120 tipwindow = gtk_window_new(GTK_WINDOW_POPUP); |
121 name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget)); | 121 name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget)); |
122 #if GTK_CHECK_VERSION(2,10,0) | |
123 gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); | 122 gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); |
124 #endif | |
125 gtk_widget_set_app_paintable(tipwindow, TRUE); | 123 gtk_widget_set_app_paintable(tipwindow, TRUE); |
126 gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip")); | 124 gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip")); |
127 gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE); | 125 gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE); |
128 gtk_widget_set_name(tipwindow, "gtk-tooltips"); | 126 gtk_widget_set_name(tipwindow, "gtk-tooltips"); |
129 gtk_widget_ensure_style(tipwindow); | 127 gtk_widget_ensure_style(tipwindow); |
134 static void | 132 static void |
135 setup_tooltip_window_position(gpointer data, int w, int h) | 133 setup_tooltip_window_position(gpointer data, int w, int h) |
136 { | 134 { |
137 int sig; | 135 int sig; |
138 int scr_w, scr_h, x, y, dy; | 136 int scr_w, scr_h, x, y, dy; |
139 #if GTK_CHECK_VERSION(2,2,0) | |
140 int mon_num; | 137 int mon_num; |
141 GdkScreen *screen = NULL; | 138 GdkScreen *screen = NULL; |
142 #endif | |
143 GdkRectangle mon_size; | 139 GdkRectangle mon_size; |
144 GtkWidget *tipwindow = pidgin_tooltip.tipwindow; | 140 GtkWidget *tipwindow = pidgin_tooltip.tipwindow; |
145 | 141 |
146 #if GTK_CHECK_VERSION(2,2,0) | |
147 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); | 142 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); |
148 mon_num = gdk_screen_get_monitor_at_point(screen, x, y); | 143 mon_num = gdk_screen_get_monitor_at_point(screen, x, y); |
149 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); | 144 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); |
150 | 145 |
151 scr_w = mon_size.width + mon_size.x; | 146 scr_w = mon_size.width + mon_size.x; |
152 scr_h = mon_size.height + mon_size.y; | 147 scr_h = mon_size.height + mon_size.y; |
153 #else | 148 |
154 scr_w = gdk_screen_width(); | |
155 scr_h = gdk_screen_height(); | |
156 gdk_window_get_pointer(NULL, &x, &y, NULL); | |
157 mon_size.x = 0; | |
158 mon_size.y = 0; | |
159 #endif | |
160 | |
161 #if GTK_CHECK_VERSION(2,4,0) | |
162 dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; | 149 dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; |
163 #else | 150 |
164 dy = 0; | |
165 #endif | |
166 | |
167 #if GTK_CHECK_VERSION(2,2,0) | |
168 if (w > mon_size.width) | 151 if (w > mon_size.width) |
169 w = mon_size.width - 10; | 152 w = mon_size.width - 10; |
170 | 153 |
171 if (h > mon_size.height) | 154 if (h > mon_size.height) |
172 h = mon_size.height - 10; | 155 h = mon_size.height - 10; |
173 #endif | 156 |
174 x -= ((w >> 1) + 4); | 157 x -= ((w >> 1) + 4); |
175 | 158 |
176 if ((y + h + 4) > scr_h) | 159 if ((y + h + 4) > scr_h) |
177 y = y - h - dy - 5; | 160 y = y - h - dy - 5; |
178 else | 161 else |