Mercurial > dwindows
comparison gtk/dw.c @ 2626:401a3b9f21ba
Massive continuation of code style standardization.
Only tested on Mac and iOS, may require follow up commits to get things
building again as I test on various platforms.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Aug 2021 12:17:07 +0000 |
parents | 156ad91481eb |
children | a1340a70923d |
comparison
equal
deleted
inserted
replaced
2625:2e804b4db81e | 2626:401a3b9f21ba |
---|---|
67 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) | 67 #if defined(DW_RESOURCES) && !defined(BUILD_DLL) |
68 extern DWResources _resources; | 68 extern DWResources _resources; |
69 #endif | 69 #endif |
70 #endif | 70 #endif |
71 | 71 |
72 GdkColor _colors[] = | 72 GdkColor _dw_colors[] = |
73 { | 73 { |
74 { 0, 0x0000, 0x0000, 0x0000 }, /* 0 black */ | 74 { 0, 0x0000, 0x0000, 0x0000 }, /* 0 black */ |
75 { 0, 0xbbbb, 0x0000, 0x0000 }, /* 1 red */ | 75 { 0, 0xbbbb, 0x0000, 0x0000 }, /* 1 red */ |
76 { 0, 0x0000, 0xbbbb, 0x0000 }, /* 2 green */ | 76 { 0, 0x0000, 0xbbbb, 0x0000 }, /* 2 green */ |
77 { 0, 0xaaaa, 0xaaaa, 0x0000 }, /* 3 yellow */ | 77 { 0, 0xaaaa, 0xaaaa, 0x0000 }, /* 3 yellow */ |
91 | 91 |
92 /* | 92 /* |
93 * List those icons that have transparency first | 93 * List those icons that have transparency first |
94 */ | 94 */ |
95 #define NUM_EXTS 9 | 95 #define NUM_EXTS 9 |
96 char *image_exts[NUM_EXTS] = | 96 char *_dw_image_exts[NUM_EXTS] = |
97 { | 97 { |
98 ".xpm", | 98 ".xpm", |
99 ".png", | 99 ".png", |
100 ".ico", | 100 ".ico", |
101 ".icns", | 101 ".icns", |
118 | 118 |
119 pthread_key_t _dw_fg_color_key; | 119 pthread_key_t _dw_fg_color_key; |
120 pthread_key_t _dw_bg_color_key; | 120 pthread_key_t _dw_bg_color_key; |
121 pthread_key_t _dw_mutex_key; | 121 pthread_key_t _dw_mutex_key; |
122 | 122 |
123 GtkWidget *last_window = NULL, *popup = NULL; | 123 GtkWidget *_dw_last_window = NULL, *_dw_popup = NULL; |
124 GdkPixmap *_dw_tmppixmap = NULL; | 124 GdkPixmap *_dw_tmppixmap = NULL; |
125 GdkBitmap *_dw_tmpbitmap = NULL; | 125 GdkBitmap *_dw_tmpbitmap = NULL; |
126 | 126 |
127 #if GLIB_CHECK_VERSION(2,28,0) | 127 #if GLIB_CHECK_VERSION(2,28,0) |
128 GApplication *_DWApp = NULL; | 128 GApplication *_DWApp = NULL; |
145 #define DEFAULT_TITLEBAR_HEIGHT 22 | 145 #define DEFAULT_TITLEBAR_HEIGHT 22 |
146 | 146 |
147 static GdkColormap *_dw_cmap = NULL; | 147 static GdkColormap *_dw_cmap = NULL; |
148 | 148 |
149 /* Signal forwarder prototypes */ | 149 /* Signal forwarder prototypes */ |
150 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data); | 150 static gint _dw_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
151 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data); | 151 static gint _dw_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
152 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data); | 152 static gint _dw_motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data); |
153 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); | 153 static gint _dw_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data); |
154 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data); | 154 static gint _dw_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data); |
155 static gint _generic_event(GtkWidget *widget, gpointer data); | 155 static gint _dw_generic_event(GtkWidget *widget, gpointer data); |
156 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); | 156 static gint _dw_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); |
157 static gint _activate_event(GtkWidget *widget, gpointer data); | 157 static gint _dw_activate_event(GtkWidget *widget, gpointer data); |
158 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data); | 158 static gint _dw_container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
159 static gint _container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); | 159 static gint _dw_container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
160 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data); | 160 static gint _dw_item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data); |
161 static gint _expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data); | 161 static gint _dw_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data); |
162 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data); | 162 static gint _dw_set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data); |
163 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); | 163 static gint _dw_tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data); |
164 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer user_data); | 164 static gint _dw_value_changed_event(GtkAdjustment *adjustment, gpointer user_data); |
165 #if GTK_MAJOR_VERSION > 1 | 165 #if GTK_MAJOR_VERSION > 1 |
166 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data); | 166 static gint _dw_tree_select_event(GtkTreeSelection *sel, gpointer data); |
167 static gint _tree_expand_event(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer data); | 167 static gint _dw_tree_expand_event(GtkTreeView *treeview, GtkTreeIter *arg1, GtkTreePath *arg2, gpointer data); |
168 #else | 168 #else |
169 static gint _tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data); | 169 static gint _dw_tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data); |
170 static gint _tree_expand_event(GtkTreeItem *treeitem, gpointer data); | 170 static gint _dw_tree_expand_event(GtkTreeItem *treeitem, gpointer data); |
171 #endif | 171 #endif |
172 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data); | 172 static gint _dw_switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data); |
173 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data); | 173 static gint _dw_column_click_event(GtkWidget *widget, gint column_num, gpointer data); |
174 #ifdef USE_WEBKIT | 174 #ifdef USE_WEBKIT |
175 static void _html_changed_event(WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data); | 175 static void _dw_html_changed_event(WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data); |
176 #endif | 176 #endif |
177 static void _dw_signal_disconnect(gpointer data, GClosure *closure); | 177 static void _dw_signal_disconnect(gpointer data, GClosure *closure); |
178 | 178 |
179 typedef struct | 179 typedef struct |
180 { | 180 { |
185 #if GTK_MAJOR_VERSION > 1 | 185 #if GTK_MAJOR_VERSION > 1 |
186 GdkPixbuf *pixbuf; | 186 GdkPixbuf *pixbuf; |
187 #endif | 187 #endif |
188 } DWPrivatePixmap; | 188 } DWPrivatePixmap; |
189 | 189 |
190 static DWPrivatePixmap *_PixmapArray = NULL; | 190 static DWPrivatePixmap *_DWPixmapArray = NULL; |
191 static int _PixmapCount = 0; | 191 static int _DWPixmapCount = 0; |
192 | 192 |
193 typedef struct | 193 typedef struct |
194 { | 194 { |
195 void *func; | 195 void *func; |
196 char name[30]; | 196 char name[30]; |
197 | 197 |
198 } SignalList; | 198 } DWSignalList; |
199 | 199 |
200 typedef struct | 200 typedef struct |
201 { | 201 { |
202 HWND window; | 202 HWND window; |
203 void *func; | 203 void *func; |
204 gpointer data; | 204 gpointer data; |
205 gint cid; | 205 gint cid; |
206 void *intfunc; | 206 void *intfunc; |
207 | 207 |
208 } SignalHandler; | 208 } DWSignalHandler; |
209 | 209 |
210 #define SIGNALMAX 20 | 210 #define SIGNALMAX 20 |
211 | 211 |
212 /* A list of signal forwarders, to account for paramater differences. */ | 212 /* A list of signal forwarders, to account for paramater differences. */ |
213 static SignalList SignalTranslate[SIGNALMAX] = { | 213 static DWSignalList DWSignalTranslate[SIGNALMAX] = { |
214 { _configure_event, DW_SIGNAL_CONFIGURE }, | 214 { _dw_configure_event, DW_SIGNAL_CONFIGURE }, |
215 { _key_press_event, DW_SIGNAL_KEY_PRESS }, | 215 { _dw_key_press_event, DW_SIGNAL_KEY_PRESS }, |
216 { _button_press_event, DW_SIGNAL_BUTTON_PRESS }, | 216 { _dw_button_press_event, DW_SIGNAL_BUTTON_PRESS }, |
217 { _button_release_event, DW_SIGNAL_BUTTON_RELEASE }, | 217 { _dw_button_release_event, DW_SIGNAL_BUTTON_RELEASE }, |
218 { _motion_notify_event, DW_SIGNAL_MOTION_NOTIFY }, | 218 { _dw_motion_notify_event, DW_SIGNAL_MOTION_NOTIFY }, |
219 { _delete_event, DW_SIGNAL_DELETE }, | 219 { _dw_delete_event, DW_SIGNAL_DELETE }, |
220 { _expose_event, DW_SIGNAL_EXPOSE }, | 220 { _dw_expose_event, DW_SIGNAL_EXPOSE }, |
221 { _activate_event, "activate" }, | 221 { _dw_activate_event, "activate" }, |
222 { _generic_event, DW_SIGNAL_CLICKED }, | 222 { _dw_generic_event, DW_SIGNAL_CLICKED }, |
223 { _container_select_event, DW_SIGNAL_ITEM_ENTER }, | 223 { _dw_container_select_event, DW_SIGNAL_ITEM_ENTER }, |
224 { _container_context_event, DW_SIGNAL_ITEM_CONTEXT }, | 224 { _dw_container_context_event, DW_SIGNAL_ITEM_CONTEXT }, |
225 { _tree_context_event, "tree-context" }, | 225 { _dw_tree_context_event, "tree-context" }, |
226 { _item_select_event, DW_SIGNAL_LIST_SELECT }, | 226 { _dw_item_select_event, DW_SIGNAL_LIST_SELECT }, |
227 { _tree_select_event, DW_SIGNAL_ITEM_SELECT }, | 227 { _dw_tree_select_event, DW_SIGNAL_ITEM_SELECT }, |
228 { _set_focus_event, DW_SIGNAL_SET_FOCUS }, | 228 { _dw_set_focus_event, DW_SIGNAL_SET_FOCUS }, |
229 { _value_changed_event, DW_SIGNAL_VALUE_CHANGED }, | 229 { _dw_value_changed_event, DW_SIGNAL_VALUE_CHANGED }, |
230 { _switch_page_event, DW_SIGNAL_SWITCH_PAGE }, | 230 { _dw_switch_page_event, DW_SIGNAL_SWITCH_PAGE }, |
231 { _column_click_event, DW_SIGNAL_COLUMN_CLICK }, | 231 { _dw_column_click_event, DW_SIGNAL_COLUMN_CLICK }, |
232 { _tree_expand_event, DW_SIGNAL_TREE_EXPAND }, | 232 { _dw_tree_expand_event, DW_SIGNAL_TREE_EXPAND }, |
233 #ifdef USE_WEBKIT | 233 #ifdef USE_WEBKIT |
234 { _html_changed_event, DW_SIGNAL_HTML_CHANGED } | 234 { _dw_html_changed_event, DW_SIGNAL_HTML_CHANGED } |
235 #else | 235 #else |
236 { _generic_event, DW_SIGNAL_HTML_CHANGED } | 236 { _dw_generic_event, DW_SIGNAL_HTML_CHANGED } |
237 #endif | 237 #endif |
238 }; | 238 }; |
239 | 239 |
240 /* Alignment flags */ | 240 /* Alignment flags */ |
241 #define DW_CENTER 0.5f | 241 #define DW_CENTER 0.5f |
310 static void gtk_mdi_class_init(GtkMdiClass *klass); | 310 static void gtk_mdi_class_init(GtkMdiClass *klass); |
311 static void gtk_mdi_init(GtkMdi *mdi); | 311 static void gtk_mdi_init(GtkMdi *mdi); |
312 | 312 |
313 static void gtk_mdi_realize(GtkWidget *widget); | 313 static void gtk_mdi_realize(GtkWidget *widget); |
314 static void gtk_mdi_size_request(GtkWidget *widget, GtkRequisition *requisition); | 314 static void gtk_mdi_size_request(GtkWidget *widget, GtkRequisition *requisition); |
315 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation); | 315 static void gtk_mdi_dw_size_allocate(GtkWidget *widget, GtkAllocation *allocation); |
316 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event); | 316 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event); |
317 | 317 |
318 /* Callbacks */ | 318 /* Callbacks */ |
319 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); | 319 static gboolean _dw_mdi_move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
320 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); | 320 static gboolean _dw_mdi_resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
321 static gboolean iconify_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); | 321 static gboolean _dw_mdi_iconify_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
322 static gboolean maximize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); | 322 static gboolean _dw_mdi_maximize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
323 static gboolean kill_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); | 323 static gboolean _dw_mdi_kill_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data); |
324 | 324 |
325 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget); | 325 static void gtk_mdi_add(GtkContainer *container, GtkWidget *widget); |
326 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget); | 326 static void gtk_mdi_remove_true(GtkContainer *container, GtkWidget *widget); |
327 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); | 327 static void gtk_mdi_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
328 | 328 |
329 static GtkMdiChild *get_child(GtkMdi *mdi, GtkWidget * widget); | 329 static GtkMdiChild *_dw_mdi_get_child(GtkMdi *mdi, GtkWidget * widget); |
330 | 330 |
331 static void _dw_log( char *format, ... ) | 331 static void _dw_log( char *format, ... ) |
332 { | 332 { |
333 va_list args; | 333 va_list args; |
334 va_start(args, format); | 334 va_start(args, format); |
380 parent_class = gtk_type_class (GTK_TYPE_CONTAINER); | 380 parent_class = gtk_type_class (GTK_TYPE_CONTAINER); |
381 | 381 |
382 widget_class->realize = gtk_mdi_realize; | 382 widget_class->realize = gtk_mdi_realize; |
383 widget_class->expose_event = gtk_mdi_expose; | 383 widget_class->expose_event = gtk_mdi_expose; |
384 widget_class->size_request = gtk_mdi_size_request; | 384 widget_class->size_request = gtk_mdi_size_request; |
385 widget_class->size_allocate = gtk_mdi_size_allocate; | 385 widget_class->size_allocate = gtk_mdi_dw_size_allocate; |
386 | 386 |
387 container_class->add = gtk_mdi_add; | 387 container_class->add = gtk_mdi_add; |
388 container_class->remove = gtk_mdi_remove_true; | 388 container_class->remove = gtk_mdi_remove_true; |
389 container_class->forall = gtk_mdi_forall; | 389 container_class->forall = gtk_mdi_forall; |
390 class->mdi = NULL; | 390 class->mdi = NULL; |
545 cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); | 545 cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); |
546 gtk_widget_realize (bottom_event_box); | 546 gtk_widget_realize (bottom_event_box); |
547 gdk_window_set_cursor (bottom_event_box->window, cursor); | 547 gdk_window_set_cursor (bottom_event_box->window, cursor); |
548 | 548 |
549 g_signal_connect (G_OBJECT (top_event_box), "event", | 549 g_signal_connect (G_OBJECT (top_event_box), "event", |
550 G_CALLBACK (move_child_callback), | 550 G_CALLBACK (_dw_mdi_move_child_callback), |
551 child); | 551 child); |
552 g_signal_connect (G_OBJECT (bottom_event_box), "event", | 552 g_signal_connect (G_OBJECT (bottom_event_box), "event", |
553 G_CALLBACK (resize_child_callback), | 553 G_CALLBACK (_dw_mdi_resize_child_callback), |
554 child); | 554 child); |
555 g_signal_connect (G_OBJECT (button[0]), "button_press_event", | 555 g_signal_connect (G_OBJECT (button[0]), "button_press_event", |
556 G_CALLBACK (iconify_child_callback), | 556 G_CALLBACK (_dw_mdi_iconify_child_callback), |
557 child); | 557 child); |
558 g_signal_connect (G_OBJECT (button[1]), "button_press_event", | 558 g_signal_connect (G_OBJECT (button[1]), "button_press_event", |
559 G_CALLBACK (maximize_child_callback), | 559 G_CALLBACK (_dw_mdi_maximize_child_callback), |
560 child); | 560 child); |
561 g_signal_connect (G_OBJECT (button[2]), "button_press_event", | 561 g_signal_connect (G_OBJECT (button[2]), "button_press_event", |
562 G_CALLBACK (kill_child_callback), | 562 G_CALLBACK (_dw_mdi_kill_child_callback), |
563 child); | 563 child); |
564 } | 564 } |
565 | 565 |
566 static void gtk_mdi_move(GtkMdi *mdi, GtkWidget *widget, gint x, gint y) | 566 static void gtk_mdi_move(GtkMdi *mdi, GtkWidget *widget, gint x, gint y) |
567 { | 567 { |
568 GtkMdiChild *child; | 568 GtkMdiChild *child; |
569 | 569 |
570 g_return_if_fail (GTK_IS_MDI (mdi)); | 570 g_return_if_fail (GTK_IS_MDI (mdi)); |
571 g_return_if_fail (GTK_IS_WIDGET (widget)); | 571 g_return_if_fail (GTK_IS_WIDGET (widget)); |
572 | 572 |
573 child = get_child (mdi, widget); | 573 child = _dw_mdi_get_child (mdi, widget); |
574 g_return_if_fail (child); | 574 g_return_if_fail (child); |
575 | 575 |
576 child->x = x; | 576 child->x = x; |
577 child->y = y; | 577 child->y = y; |
578 if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (mdi)) | 578 if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (mdi)) |
584 GtkMdiChild *child; | 584 GtkMdiChild *child; |
585 | 585 |
586 g_return_if_fail (GTK_IS_MDI (mdi)); | 586 g_return_if_fail (GTK_IS_MDI (mdi)); |
587 g_return_if_fail (GTK_IS_WIDGET (widget)); | 587 g_return_if_fail (GTK_IS_WIDGET (widget)); |
588 | 588 |
589 child = get_child (mdi, widget); | 589 child = _dw_mdi_get_child (mdi, widget); |
590 g_return_if_fail (child); | 590 g_return_if_fail (child); |
591 | 591 |
592 *x = child->x; | 592 *x = child->x; |
593 *y = child->y; | 593 *y = child->y; |
594 } | 594 } |
659 GtkMdiChild *child; | 659 GtkMdiChild *child; |
660 | 660 |
661 g_return_val_if_fail (GTK_IS_MDI (mdi), CHILD_NORMAL); | 661 g_return_val_if_fail (GTK_IS_MDI (mdi), CHILD_NORMAL); |
662 g_return_val_if_fail (GTK_IS_WIDGET (widget), CHILD_NORMAL); | 662 g_return_val_if_fail (GTK_IS_WIDGET (widget), CHILD_NORMAL); |
663 | 663 |
664 child = get_child (mdi, widget); | 664 child = _dw_mdi_get_child (mdi, widget); |
665 g_return_val_if_fail (child, CHILD_NORMAL); | 665 g_return_val_if_fail (child, CHILD_NORMAL); |
666 | 666 |
667 return child->state; | 667 return child->state; |
668 } | 668 } |
669 #endif | 669 #endif |
673 GtkMdiChild *child; | 673 GtkMdiChild *child; |
674 | 674 |
675 g_return_if_fail (GTK_IS_MDI (mdi)); | 675 g_return_if_fail (GTK_IS_MDI (mdi)); |
676 g_return_if_fail (GTK_IS_WIDGET (widget)); | 676 g_return_if_fail (GTK_IS_WIDGET (widget)); |
677 | 677 |
678 child = get_child (mdi, widget); | 678 child = _dw_mdi_get_child (mdi, widget); |
679 g_return_if_fail (child); | 679 g_return_if_fail (child); |
680 | 680 |
681 child->state = state; | 681 child->state = state; |
682 if (GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_VISIBLE (mdi)) | 682 if (GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_VISIBLE (mdi)) |
683 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); | 683 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
686 static void gtk_mdi_remove(GtkMdi *mdi, GtkWidget *widget) | 686 static void gtk_mdi_remove(GtkMdi *mdi, GtkWidget *widget) |
687 { | 687 { |
688 GtkMdiChild *child; | 688 GtkMdiChild *child; |
689 | 689 |
690 g_return_if_fail (GTK_IS_MDI (mdi)); | 690 g_return_if_fail (GTK_IS_MDI (mdi)); |
691 child = get_child (mdi, widget); | 691 child = _dw_mdi_get_child (mdi, widget); |
692 g_return_if_fail (child); | 692 g_return_if_fail (child); |
693 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); | 693 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
694 } | 694 } |
695 | 695 |
696 static void gtk_mdi_realize(GtkWidget *widget) | 696 static void gtk_mdi_realize(GtkWidget *widget) |
751 gtk_widget_size_request (child->widget, &child_requisition); | 751 gtk_widget_size_request (child->widget, &child_requisition); |
752 } | 752 } |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 static void gtk_mdi_size_allocate(GtkWidget *widget, GtkAllocation *allocation) | 756 static void gtk_mdi_dw_size_allocate(GtkWidget *widget, GtkAllocation *allocation) |
757 { | 757 { |
758 GtkMdi *mdi; | 758 GtkMdi *mdi; |
759 GtkMdiChild *child; | 759 GtkMdiChild *child; |
760 GtkAllocation child_allocation; | 760 GtkAllocation child_allocation; |
761 GtkRequisition child_requisition; | 761 GtkRequisition child_requisition; |
827 child_allocation.width = child_requisition.width; | 827 child_allocation.width = child_requisition.width; |
828 child_allocation.height = GTK_MDI_MIN_HEIGHT; | 828 child_allocation.height = GTK_MDI_MIN_HEIGHT; |
829 break; | 829 break; |
830 } | 830 } |
831 } | 831 } |
832 gtk_widget_size_allocate (child->widget, &child_allocation); | 832 gtk_widget_dw_size_allocate (child->widget, &child_allocation); |
833 } | 833 } |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event) | 837 static gint gtk_mdi_expose(GtkWidget *widget, GdkEventExpose *event) |
907 | 907 |
908 (*callback) (child->widget, callback_data); | 908 (*callback) (child->widget, callback_data); |
909 } | 909 } |
910 } | 910 } |
911 | 911 |
912 static gboolean move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) | 912 static gboolean _dw_mdi_move_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
913 { | 913 { |
914 GtkMdi *mdi; | 914 GtkMdi *mdi; |
915 GtkMdiChild *child; | 915 GtkMdiChild *child; |
916 | 916 |
917 child = (GtkMdiChild *) data; | 917 child = (GtkMdiChild *) data; |
989 } | 989 } |
990 | 990 |
991 return FALSE; | 991 return FALSE; |
992 } | 992 } |
993 | 993 |
994 static gboolean resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) | 994 static gboolean _dw_mdi_resize_child_callback(GtkWidget *widget, GdkEvent *event, gpointer data) |
995 { | 995 { |
996 GtkMdi *mdi; | 996 GtkMdi *mdi; |
997 GtkMdiChild *child; | 997 GtkMdiChild *child; |
998 | 998 |
999 child = (GtkMdiChild *) data; | 999 child = (GtkMdiChild *) data; |
1077 } | 1077 } |
1078 | 1078 |
1079 return FALSE; | 1079 return FALSE; |
1080 } | 1080 } |
1081 | 1081 |
1082 static gboolean iconify_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) | 1082 static gboolean _dw_mdi_iconify_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
1083 { | 1083 { |
1084 GtkMdiChild *child; | 1084 GtkMdiChild *child; |
1085 child = (GtkMdiChild *) data; | 1085 child = (GtkMdiChild *) data; |
1086 if (child->state == CHILD_ICONIFIED) | 1086 if (child->state == CHILD_ICONIFIED) |
1087 { | 1087 { |
1094 if (GTK_WIDGET_VISIBLE (child->widget)) | 1094 if (GTK_WIDGET_VISIBLE (child->widget)) |
1095 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); | 1095 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
1096 return FALSE; | 1096 return FALSE; |
1097 } | 1097 } |
1098 | 1098 |
1099 static gboolean maximize_child_callback (GtkWidget *widget, GdkEvent * event, gpointer data) | 1099 static gboolean _dw_mdi_maximize_child_callback (GtkWidget *widget, GdkEvent * event, gpointer data) |
1100 { | 1100 { |
1101 GtkMdiChild *child; | 1101 GtkMdiChild *child; |
1102 child = (GtkMdiChild *) data; | 1102 child = (GtkMdiChild *) data; |
1103 if (child->state == CHILD_MAXIMIZED) | 1103 if (child->state == CHILD_MAXIMIZED) |
1104 { | 1104 { |
1111 if (GTK_WIDGET_VISIBLE (child->widget)) | 1111 if (GTK_WIDGET_VISIBLE (child->widget)) |
1112 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); | 1112 gtk_widget_queue_resize (GTK_WIDGET (child->widget)); |
1113 return FALSE; | 1113 return FALSE; |
1114 } | 1114 } |
1115 | 1115 |
1116 static gboolean kill_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) | 1116 static gboolean _dw_mdi_kill_child_callback (GtkWidget *widget, GdkEvent *event, gpointer data) |
1117 { | 1117 { |
1118 GtkMdiChild *child; | 1118 GtkMdiChild *child; |
1119 GtkMdi *mdi; | 1119 GtkMdi *mdi; |
1120 | 1120 |
1121 child = (GtkMdiChild *) data; | 1121 child = (GtkMdiChild *) data; |
1125 | 1125 |
1126 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); | 1126 gtk_mdi_remove_true (GTK_CONTAINER (mdi), child->widget); |
1127 return FALSE; | 1127 return FALSE; |
1128 } | 1128 } |
1129 | 1129 |
1130 static GtkMdiChild *get_child (GtkMdi *mdi, GtkWidget *widget) | 1130 static GtkMdiChild *_dw_mdi_get_child (GtkMdi *mdi, GtkWidget *widget) |
1131 { | 1131 { |
1132 GList *children; | 1132 GList *children; |
1133 | 1133 |
1134 children = mdi->children; | 1134 children = mdi->children; |
1135 while (children) | 1135 while (children) |
1166 usleep(period * 1000); | 1166 usleep(period * 1000); |
1167 #endif | 1167 #endif |
1168 } | 1168 } |
1169 | 1169 |
1170 /* Finds the translation function for a given signal name */ | 1170 /* Finds the translation function for a given signal name */ |
1171 static void *_findsigfunc(const char *signame) | 1171 static void *_dw_findsigfunc(const char *signame) |
1172 { | 1172 { |
1173 int z; | 1173 int z; |
1174 | 1174 |
1175 for(z=0;z<SIGNALMAX;z++) | 1175 for(z=0;z<SIGNALMAX;z++) |
1176 { | 1176 { |
1177 if(strcasecmp(signame, SignalTranslate[z].name) == 0) | 1177 if(strcasecmp(signame, DWSignalTranslate[z].name) == 0) |
1178 return SignalTranslate[z].func; | 1178 return DWSignalTranslate[z].func; |
1179 } | 1179 } |
1180 return NULL; | 1180 return NULL; |
1181 } | 1181 } |
1182 | 1182 |
1183 static SignalHandler _get_signal_handler(gpointer data) | 1183 static DWSignalHandler _dw_get_signal_handler(gpointer data) |
1184 { | 1184 { |
1185 SignalHandler sh = {0}; | 1185 DWSignalHandler sh = {0}; |
1186 | 1186 |
1187 if(data) | 1187 if(data) |
1188 { | 1188 { |
1189 void **params = (void **)data; | 1189 void **params = (void **)data; |
1190 int counter = GPOINTER_TO_INT(params[0]); | 1190 int counter = GPOINTER_TO_INT(params[0]); |
1203 sh.cid = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget), text)); | 1203 sh.cid = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget), text)); |
1204 } | 1204 } |
1205 return sh; | 1205 return sh; |
1206 } | 1206 } |
1207 | 1207 |
1208 static void _remove_signal_handler(GtkWidget *widget, int counter) | 1208 static void _dw_remove_signal_handler(GtkWidget *widget, int counter) |
1209 { | 1209 { |
1210 char text[101] = {0}; | 1210 char text[101] = {0}; |
1211 gint cid; | 1211 gint cid; |
1212 | 1212 |
1213 snprintf(text, 100, "_dw_sigcid%d", counter); | 1213 snprintf(text, 100, "_dw_sigcid%d", counter); |
1222 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); | 1222 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1223 snprintf(text, 100, "_dw_sigdata%d", counter); | 1223 snprintf(text, 100, "_dw_sigdata%d", counter); |
1224 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); | 1224 gtk_object_set_data(GTK_OBJECT(widget), text, NULL); |
1225 } | 1225 } |
1226 | 1226 |
1227 static int _set_signal_handler(GtkWidget *widget, HWND window, void *func, gpointer data, void *intfunc) | 1227 static int _dw_set_signal_handler(GtkWidget *widget, HWND window, void *func, gpointer data, void *intfunc) |
1228 { | 1228 { |
1229 int counter = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget), "_dw_sigcounter")); | 1229 int counter = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget), "_dw_sigcounter")); |
1230 char text[101] = {0}; | 1230 char text[101] = {0}; |
1231 | 1231 |
1232 snprintf(text, 100, "_dw_sigwindow%d", counter); | 1232 snprintf(text, 100, "_dw_sigwindow%d", counter); |
1242 gtk_object_set_data(GTK_OBJECT(widget), "_dw_sigcounter", GINT_TO_POINTER(counter)); | 1242 gtk_object_set_data(GTK_OBJECT(widget), "_dw_sigcounter", GINT_TO_POINTER(counter)); |
1243 | 1243 |
1244 return counter - 1; | 1244 return counter - 1; |
1245 } | 1245 } |
1246 | 1246 |
1247 static void _set_signal_handler_id(GtkWidget *widget, int counter, gint cid) | 1247 static void _dw_set_signal_handler_id(GtkWidget *widget, int counter, gint cid) |
1248 { | 1248 { |
1249 char text[101] = {0}; | 1249 char text[101] = {0}; |
1250 | 1250 |
1251 snprintf(text, 100, "_dw_sigcid%d", counter); | 1251 snprintf(text, 100, "_dw_sigcid%d", counter); |
1252 gtk_object_set_data(GTK_OBJECT(widget), text, GINT_TO_POINTER(cid)); | 1252 gtk_object_set_data(GTK_OBJECT(widget), text, GINT_TO_POINTER(cid)); |
1253 } | 1253 } |
1254 | 1254 |
1255 #ifdef USE_WEBKIT | 1255 #ifdef USE_WEBKIT |
1256 static void _html_changed_event(WebKitWebView *web_view, WebKitWebFrame *frame, gpointer data) | 1256 static void _dw_html_changed_event(WebKitWebView *web_view, WebKitWebFrame *frame, gpointer data) |
1257 { | 1257 { |
1258 SignalHandler work = _get_signal_handler(data); | 1258 DWSignalHandler work = _dw_get_signal_handler(data); |
1259 char *location = (char *)webkit_web_view_get_uri(web_view); | 1259 char *location = (char *)webkit_web_view_get_uri(web_view); |
1260 int status = 0; | 1260 int status = 0; |
1261 void **params = data; | 1261 void **params = data; |
1262 | 1262 |
1263 if(params) | 1263 if(params) |
1270 htmlchangedfunc(work.window, status, location, work.data); | 1270 htmlchangedfunc(work.window, status, location, work.data); |
1271 } | 1271 } |
1272 } | 1272 } |
1273 #endif | 1273 #endif |
1274 | 1274 |
1275 static gint _set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data) | 1275 static gint _dw_set_focus_event(GtkWindow *window, GtkWidget *widget, gpointer data) |
1276 { | 1276 { |
1277 SignalHandler work = _get_signal_handler(data); | 1277 DWSignalHandler work = _dw_get_signal_handler(data); |
1278 int retval = FALSE; | 1278 int retval = FALSE; |
1279 | 1279 |
1280 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1280 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1281 if(work.window) | 1281 if(work.window) |
1282 { | 1282 { |
1285 retval = setfocusfunc(work.window, work.data); | 1285 retval = setfocusfunc(work.window, work.data); |
1286 } | 1286 } |
1287 return retval; | 1287 return retval; |
1288 } | 1288 } |
1289 | 1289 |
1290 static gint _button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 1290 static gint _dw_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
1291 { | 1291 { |
1292 SignalHandler work = _get_signal_handler(data); | 1292 DWSignalHandler work = _dw_get_signal_handler(data); |
1293 int retval = FALSE; | 1293 int retval = FALSE; |
1294 | 1294 |
1295 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1295 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1296 if(work.window) | 1296 if(work.window) |
1297 { | 1297 { |
1306 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); | 1306 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
1307 } | 1307 } |
1308 return retval; | 1308 return retval; |
1309 } | 1309 } |
1310 | 1310 |
1311 static gint _button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 1311 static gint _dw_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
1312 { | 1312 { |
1313 SignalHandler work = _get_signal_handler(data); | 1313 DWSignalHandler work = _dw_get_signal_handler(data); |
1314 int retval = FALSE; | 1314 int retval = FALSE; |
1315 | 1315 |
1316 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1316 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1317 if(work.window) | 1317 if(work.window) |
1318 { | 1318 { |
1327 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); | 1327 retval = buttonfunc(work.window, event->x, event->y, mybutton, work.data); |
1328 } | 1328 } |
1329 return retval; | 1329 return retval; |
1330 } | 1330 } |
1331 | 1331 |
1332 static gint _motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | 1332 static gint _dw_motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
1333 { | 1333 { |
1334 SignalHandler work = _get_signal_handler(data); | 1334 DWSignalHandler work = _dw_get_signal_handler(data); |
1335 int retval = FALSE; | 1335 int retval = FALSE; |
1336 | 1336 |
1337 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1337 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1338 if(work.window) | 1338 if(work.window) |
1339 { | 1339 { |
1360 retval = motionfunc(work.window, x, y, keys, work.data); | 1360 retval = motionfunc(work.window, x, y, keys, work.data); |
1361 } | 1361 } |
1362 return retval; | 1362 return retval; |
1363 } | 1363 } |
1364 | 1364 |
1365 static gint _delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) | 1365 static gint _dw_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) |
1366 { | 1366 { |
1367 SignalHandler work = _get_signal_handler(data); | 1367 DWSignalHandler work = _dw_get_signal_handler(data); |
1368 int retval = FALSE; | 1368 int retval = FALSE; |
1369 | 1369 |
1370 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1370 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1371 if(work.window) | 1371 if(work.window) |
1372 { | 1372 { |
1375 retval = closefunc(work.window, work.data); | 1375 retval = closefunc(work.window, work.data); |
1376 } | 1376 } |
1377 return retval; | 1377 return retval; |
1378 } | 1378 } |
1379 | 1379 |
1380 static gint _key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1380 static gint _dw_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1381 { | 1381 { |
1382 SignalHandler work = _get_signal_handler(data); | 1382 DWSignalHandler work = _dw_get_signal_handler(data); |
1383 int retval = FALSE; | 1383 int retval = FALSE; |
1384 | 1384 |
1385 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1385 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1386 if(work.window) | 1386 if(work.window) |
1387 { | 1387 { |
1395 event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK), work.data, utf8); | 1395 event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK), work.data, utf8); |
1396 } | 1396 } |
1397 return retval; | 1397 return retval; |
1398 } | 1398 } |
1399 | 1399 |
1400 static gint _generic_event(GtkWidget *widget, gpointer data) | 1400 static gint _dw_generic_event(GtkWidget *widget, gpointer data) |
1401 { | 1401 { |
1402 SignalHandler work = _get_signal_handler(data); | 1402 DWSignalHandler work = _dw_get_signal_handler(data); |
1403 int retval = FALSE; | 1403 int retval = FALSE; |
1404 | 1404 |
1405 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1405 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1406 if(work.window) | 1406 if(work.window) |
1407 { | 1407 { |
1410 retval = genericfunc(work.window, work.data); | 1410 retval = genericfunc(work.window, work.data); |
1411 } | 1411 } |
1412 return retval; | 1412 return retval; |
1413 } | 1413 } |
1414 | 1414 |
1415 static gint _activate_event(GtkWidget *widget, gpointer data) | 1415 static gint _dw_activate_event(GtkWidget *widget, gpointer data) |
1416 { | 1416 { |
1417 SignalHandler work = _get_signal_handler(data); | 1417 DWSignalHandler work = _dw_get_signal_handler(data); |
1418 int retval = FALSE; | 1418 int retval = FALSE; |
1419 | 1419 |
1420 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1420 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1421 if(work.window && !_dw_ignore_click) | 1421 if(work.window && !_dw_ignore_click) |
1422 { | 1422 { |
1423 int (*activatefunc)(HWND, void *) = work.func; | 1423 int (*activatefunc)(HWND, void *) = work.func; |
1424 | 1424 |
1425 retval = activatefunc(popup ? popup : work.window, work.data); | 1425 retval = activatefunc(_dw_popup ? _dw_popup : work.window, work.data); |
1426 popup = NULL; | 1426 _dw_popup = NULL; |
1427 } | 1427 } |
1428 return retval; | 1428 return retval; |
1429 } | 1429 } |
1430 | 1430 |
1431 static gint _configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) | 1431 static gint _dw_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) |
1432 { | 1432 { |
1433 SignalHandler work = _get_signal_handler(data); | 1433 DWSignalHandler work = _dw_get_signal_handler(data); |
1434 int retval = FALSE; | 1434 int retval = FALSE; |
1435 | 1435 |
1436 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1436 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1437 if(work.window) | 1437 if(work.window) |
1438 { | 1438 { |
1441 retval = sizefunc(work.window, event->width, event->height, work.data); | 1441 retval = sizefunc(work.window, event->width, event->height, work.data); |
1442 } | 1442 } |
1443 return retval; | 1443 return retval; |
1444 } | 1444 } |
1445 | 1445 |
1446 static gint _expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) | 1446 static gint _dw_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) |
1447 { | 1447 { |
1448 SignalHandler work = _get_signal_handler(data); | 1448 DWSignalHandler work = _dw_get_signal_handler(data); |
1449 int retval = FALSE; | 1449 int retval = FALSE; |
1450 | 1450 |
1451 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1451 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1452 if(work.window) | 1452 if(work.window) |
1453 { | 1453 { |
1461 retval = exposefunc(work.window, &exp, work.data); | 1461 retval = exposefunc(work.window, &exp, work.data); |
1462 } | 1462 } |
1463 return retval; | 1463 return retval; |
1464 } | 1464 } |
1465 | 1465 |
1466 static gint _item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data) | 1466 static gint _dw_item_select_event(GtkWidget *widget, GtkWidget *child, gpointer data) |
1467 { | 1467 { |
1468 SignalHandler work = _get_signal_handler(data); | 1468 DWSignalHandler work = _dw_get_signal_handler(data); |
1469 static int _dw_recursing = 0; | 1469 static int _dw_recursing = 0; |
1470 int retval = FALSE; | 1470 int retval = FALSE; |
1471 | 1471 |
1472 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1472 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1473 if(_dw_recursing) | 1473 if(_dw_recursing) |
1506 _dw_recursing = 0; | 1506 _dw_recursing = 0; |
1507 } | 1507 } |
1508 return retval; | 1508 return retval; |
1509 } | 1509 } |
1510 | 1510 |
1511 static gint _container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 1511 static gint _dw_container_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
1512 { | 1512 { |
1513 SignalHandler work = _get_signal_handler(data); | 1513 DWSignalHandler work = _dw_get_signal_handler(data); |
1514 int retval = FALSE; | 1514 int retval = FALSE; |
1515 | 1515 |
1516 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1516 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1517 if(work.window) | 1517 if(work.window) |
1518 { | 1518 { |
1529 } | 1529 } |
1530 } | 1530 } |
1531 return retval; | 1531 return retval; |
1532 } | 1532 } |
1533 | 1533 |
1534 static gint _tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 1534 static gint _dw_tree_context_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
1535 { | 1535 { |
1536 SignalHandler work = _get_signal_handler(data); | 1536 DWSignalHandler work = _dw_get_signal_handler(data); |
1537 int retval = FALSE; | 1537 int retval = FALSE; |
1538 | 1538 |
1539 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1539 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1540 if(work.window) | 1540 if(work.window) |
1541 { | 1541 { |
1586 } | 1586 } |
1587 return retval; | 1587 return retval; |
1588 } | 1588 } |
1589 | 1589 |
1590 #if GTK_MAJOR_VERSION > 1 | 1590 #if GTK_MAJOR_VERSION > 1 |
1591 static gint _tree_select_event(GtkTreeSelection *sel, gpointer data) | 1591 static gint _dw_tree_select_event(GtkTreeSelection *sel, gpointer data) |
1592 { | 1592 { |
1593 GtkWidget *item, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); | 1593 GtkWidget *item, *widget = (GtkWidget *)gtk_tree_selection_get_tree_view(sel); |
1594 int retval = FALSE; | 1594 int retval = FALSE; |
1595 | 1595 |
1596 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1596 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1597 if(widget) | 1597 if(widget) |
1598 { | 1598 { |
1599 SignalHandler work = _get_signal_handler(data); | 1599 DWSignalHandler work = _dw_get_signal_handler(data); |
1600 | 1600 |
1601 if(work.window) | 1601 if(work.window) |
1602 { | 1602 { |
1603 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; | 1603 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = work.func; |
1604 GtkTreeIter iter; | 1604 GtkTreeIter iter; |
1614 } | 1614 } |
1615 } | 1615 } |
1616 return retval; | 1616 return retval; |
1617 } | 1617 } |
1618 | 1618 |
1619 static gint _tree_expand_event(GtkTreeView *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer data) | 1619 static gint _dw_tree_expand_event(GtkTreeView *widget, GtkTreeIter *iter, GtkTreePath *path, gpointer data) |
1620 { | 1620 { |
1621 SignalHandler work = _get_signal_handler(data); | 1621 DWSignalHandler work = _dw_get_signal_handler(data); |
1622 int retval = FALSE; | 1622 int retval = FALSE; |
1623 | 1623 |
1624 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1624 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1625 if(!_dw_ignore_expand && work.window) | 1625 if(!_dw_ignore_expand && work.window) |
1626 { | 1626 { |
1628 retval = treeexpandfunc(work.window, (HTREEITEM)iter, work.data); | 1628 retval = treeexpandfunc(work.window, (HTREEITEM)iter, work.data); |
1629 } | 1629 } |
1630 return retval; | 1630 return retval; |
1631 } | 1631 } |
1632 #else | 1632 #else |
1633 static gint _tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data) | 1633 static gint _dw_tree_select_event(GtkTree *tree, GtkWidget *child, gpointer data) |
1634 { | 1634 { |
1635 SignalHandler work = _get_signal_handler(data); | 1635 DWSignalHandler work = _dw_get_signal_handler(data); |
1636 GtkWidget *treeroot = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(child), "_dw_tree"); | 1636 GtkWidget *treeroot = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(child), "_dw_tree"); |
1637 int retval = FALSE; | 1637 int retval = FALSE; |
1638 | 1638 |
1639 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1639 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1640 if(treeroot && GTK_IS_TREE(treeroot)) | 1640 if(treeroot && GTK_IS_TREE(treeroot)) |
1653 retval = treeselectfunc(work.window, (HTREEITEM)child, text, work.data, itemdata); | 1653 retval = treeselectfunc(work.window, (HTREEITEM)child, text, work.data, itemdata); |
1654 } | 1654 } |
1655 return retval; | 1655 return retval; |
1656 } | 1656 } |
1657 | 1657 |
1658 static gint _tree_expand_event(GtkTreeItem *treeitem, gpointer data) | 1658 static gint _dw_tree_expand_event(GtkTreeItem *treeitem, gpointer data) |
1659 { | 1659 { |
1660 SignalHandler work = _get_signal_handler(data); | 1660 DWSignalHandler work = _dw_get_signal_handler(data); |
1661 int retval = FALSE; | 1661 int retval = FALSE; |
1662 | 1662 |
1663 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1663 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1664 if(!_dw_ignore_expand && work.window) | 1664 if(!_dw_ignore_expand && work.window) |
1665 { | 1665 { |
1668 } | 1668 } |
1669 return retval; | 1669 return retval; |
1670 } | 1670 } |
1671 #endif | 1671 #endif |
1672 | 1672 |
1673 static gint _container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data) | 1673 static gint _dw_container_select_event(GtkWidget *widget, GdkEventButton *event, gpointer data) |
1674 { | 1674 { |
1675 SignalHandler work = _get_signal_handler(data); | 1675 DWSignalHandler work = _dw_get_signal_handler(data); |
1676 int retval = FALSE; | 1676 int retval = FALSE; |
1677 | 1677 |
1678 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1678 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1679 if(work.window) | 1679 if(work.window) |
1680 { | 1680 { |
1692 } | 1692 } |
1693 } | 1693 } |
1694 return retval; | 1694 return retval; |
1695 } | 1695 } |
1696 | 1696 |
1697 static gint _container_enter_event(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1697 static gint _dw_container_enter_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1698 { | 1698 { |
1699 SignalHandler work = _get_signal_handler(data); | 1699 DWSignalHandler work = _dw_get_signal_handler(data); |
1700 int retval = FALSE; | 1700 int retval = FALSE; |
1701 | 1701 |
1702 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1702 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1703 if(work.window && event->keyval == VK_RETURN) | 1703 if(work.window && event->keyval == VK_RETURN) |
1704 { | 1704 { |
1710 } | 1710 } |
1711 return retval; | 1711 return retval; |
1712 } | 1712 } |
1713 | 1713 |
1714 /* Return the logical page id from the physical page id */ | 1714 /* Return the logical page id from the physical page id */ |
1715 int _get_logical_page(HWND handle, unsigned long pageid) | 1715 int _dw_get_logical_page(HWND handle, unsigned long pageid) |
1716 { | 1716 { |
1717 int z; | 1717 int z; |
1718 GtkWidget **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); | 1718 GtkWidget **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
1719 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); | 1719 GtkWidget *thispage = gtk_notebook_get_nth_page(GTK_NOTEBOOK(handle), pageid); |
1720 | 1720 |
1728 } | 1728 } |
1729 return 256; | 1729 return 256; |
1730 } | 1730 } |
1731 | 1731 |
1732 | 1732 |
1733 static gint _switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data) | 1733 static gint _dw_switch_page_event(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer data) |
1734 { | 1734 { |
1735 SignalHandler work = _get_signal_handler(data); | 1735 DWSignalHandler work = _dw_get_signal_handler(data); |
1736 int retval = FALSE; | 1736 int retval = FALSE; |
1737 | 1737 |
1738 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1738 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1739 if(work.window) | 1739 if(work.window) |
1740 { | 1740 { |
1741 int (*switchpagefunc)(HWND, unsigned long, void *) = work.func; | 1741 int (*switchpagefunc)(HWND, unsigned long, void *) = work.func; |
1742 retval = switchpagefunc(work.window, _get_logical_page(GTK_WIDGET(notebook), page_num), work.data); | 1742 retval = switchpagefunc(work.window, _dw_get_logical_page(GTK_WIDGET(notebook), page_num), work.data); |
1743 } | 1743 } |
1744 return retval; | 1744 return retval; |
1745 } | 1745 } |
1746 | 1746 |
1747 static gint _column_click_event(GtkWidget *widget, gint column_num, gpointer data) | 1747 static gint _dw_column_click_event(GtkWidget *widget, gint column_num, gpointer data) |
1748 { | 1748 { |
1749 SignalHandler work = _get_signal_handler(data); | 1749 DWSignalHandler work = _dw_get_signal_handler(data); |
1750 int retval = FALSE; | 1750 int retval = FALSE; |
1751 | 1751 |
1752 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1752 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1753 if(work.window) | 1753 if(work.window) |
1754 { | 1754 { |
1756 retval = clickcolumnfunc(work.window, column_num, work.data); | 1756 retval = clickcolumnfunc(work.window, column_num, work.data); |
1757 } | 1757 } |
1758 return retval; | 1758 return retval; |
1759 } | 1759 } |
1760 | 1760 |
1761 static gint _container_select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) | 1761 static gint _dw_container_select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) |
1762 { | 1762 { |
1763 SignalHandler work = _get_signal_handler(data); | 1763 DWSignalHandler work = _dw_get_signal_handler(data); |
1764 void **rowdata = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), row); | 1764 void **rowdata = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), row); |
1765 int (*contextfunc)(HWND, HWND, char *, void *, void *) = work.func; | 1765 int (*contextfunc)(HWND, HWND, char *, void *, void *) = work.func; |
1766 | 1766 |
1767 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1767 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1768 if(!work.window) | 1768 if(!work.window) |
1774 return TRUE; | 1774 return TRUE; |
1775 } | 1775 } |
1776 return contextfunc(work.window, 0, rowdata ? rowdata[0] : NULL, work.data, rowdata ? rowdata[1] : NULL);; | 1776 return contextfunc(work.window, 0, rowdata ? rowdata[0] : NULL, work.data, rowdata ? rowdata[1] : NULL);; |
1777 } | 1777 } |
1778 | 1778 |
1779 static int _round_value(gfloat val) | 1779 static int _dw_round_value(gfloat val) |
1780 { | 1780 { |
1781 int newval = (int)val; | 1781 int newval = (int)val; |
1782 | 1782 |
1783 if(val >= 0.5 + (gfloat)newval) | 1783 if(val >= 0.5 + (gfloat)newval) |
1784 newval++; | 1784 newval++; |
1785 | 1785 |
1786 return newval; | 1786 return newval; |
1787 } | 1787 } |
1788 | 1788 |
1789 static gint _value_changed_event(GtkAdjustment *adjustment, gpointer data) | 1789 static gint _dw_value_changed_event(GtkAdjustment *adjustment, gpointer data) |
1790 { | 1790 { |
1791 int max = _round_value(adjustment->upper); | 1791 int max = _dw_round_value(adjustment->upper); |
1792 int val = _round_value(adjustment->value); | 1792 int val = _dw_round_value(adjustment->value); |
1793 GtkWidget *slider = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_slider"); | 1793 GtkWidget *slider = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_slider"); |
1794 GtkWidget *spinbutton = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_spinbutton"); | 1794 GtkWidget *spinbutton = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_spinbutton"); |
1795 GtkWidget *scrollbar = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_scrollbar"); | 1795 GtkWidget *scrollbar = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_scrollbar"); |
1796 | 1796 |
1797 if(gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_suppress_value_changed_event")) | 1797 if(gtk_object_get_data(GTK_OBJECT(adjustment), "_dw_suppress_dw_value_changed_event")) |
1798 return FALSE; | 1798 return FALSE; |
1799 | 1799 |
1800 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1800 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1801 | 1801 |
1802 if (slider || spinbutton || scrollbar) | 1802 if (slider || spinbutton || scrollbar) |
1803 { | 1803 { |
1804 SignalHandler work = _get_signal_handler(data); | 1804 DWSignalHandler work = _dw_get_signal_handler(data); |
1805 | 1805 |
1806 if (work.window) | 1806 if (work.window) |
1807 { | 1807 { |
1808 int (*valuechangedfunc)(HWND, int, void *) = work.func; | 1808 int (*valuechangedfunc)(HWND, int, void *) = work.func; |
1809 | 1809 |
1814 } | 1814 } |
1815 } | 1815 } |
1816 return FALSE; | 1816 return FALSE; |
1817 } | 1817 } |
1818 | 1818 |
1819 static gint _default_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) | 1819 static gint _dw_default_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) |
1820 { | 1820 { |
1821 GtkWidget *next = (GtkWidget *)data; | 1821 GtkWidget *next = (GtkWidget *)data; |
1822 | 1822 |
1823 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); | 1823 if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__); |
1824 if(next) | 1824 if(next) |
1832 } | 1832 } |
1833 } | 1833 } |
1834 return FALSE; | 1834 return FALSE; |
1835 } | 1835 } |
1836 | 1836 |
1837 static GdkPixmap *_find_private_pixmap(GdkBitmap **bitmap, HICN icon, unsigned long *userwidth, unsigned long *userheight) | 1837 static GdkPixmap *_dw_find_private_pixmap(GdkBitmap **bitmap, HICN icon, unsigned long *userwidth, unsigned long *userheight) |
1838 { | 1838 { |
1839 int id = GPOINTER_TO_INT(icon); | 1839 int id = GPOINTER_TO_INT(icon); |
1840 | 1840 |
1841 if(id < _PixmapCount && _PixmapArray[id].used) | 1841 if(id < _DWPixmapCount && _DWPixmapArray[id].used) |
1842 { | 1842 { |
1843 *bitmap = _PixmapArray[id].mask; | 1843 *bitmap = _DWPixmapArray[id].mask; |
1844 if(userwidth) | 1844 if(userwidth) |
1845 *userwidth = _PixmapArray[id].width; | 1845 *userwidth = _DWPixmapArray[id].width; |
1846 if(userheight) | 1846 if(userheight) |
1847 *userheight = _PixmapArray[id].height; | 1847 *userheight = _DWPixmapArray[id].height; |
1848 return _PixmapArray[id].pixmap; | 1848 return _DWPixmapArray[id].pixmap; |
1849 } | 1849 } |
1850 return NULL; | 1850 return NULL; |
1851 } | 1851 } |
1852 | 1852 |
1853 #if GTK_MAJOR_VERSION > 1 | 1853 #if GTK_MAJOR_VERSION > 1 |
1870 return NULL; | 1870 return NULL; |
1871 #endif | 1871 #endif |
1872 } | 1872 } |
1873 #endif | 1873 #endif |
1874 | 1874 |
1875 static GdkPixmap *_find_pixmap(GdkBitmap **bitmap, HICN icon, HWND handle, unsigned long *userwidth, unsigned long *userheight) | 1875 static GdkPixmap *_dw_find_pixmap(GdkBitmap **bitmap, HICN icon, HWND handle, unsigned long *userwidth, unsigned long *userheight) |
1876 { | 1876 { |
1877 unsigned int id = GPOINTER_TO_INT(icon); | 1877 unsigned int id = GPOINTER_TO_INT(icon); |
1878 #if GTK_MAJOR_VERSION > 1 | 1878 #if GTK_MAJOR_VERSION > 1 |
1879 GdkPixbuf *icon_pixbuf = NULL; | 1879 GdkPixbuf *icon_pixbuf = NULL; |
1880 #endif | 1880 #endif |
1883 /* Quick dropout for non-handle */ | 1883 /* Quick dropout for non-handle */ |
1884 if(!icon) | 1884 if(!icon) |
1885 return NULL; | 1885 return NULL; |
1886 | 1886 |
1887 if(id & (1 << 31)) | 1887 if(id & (1 << 31)) |
1888 return _find_private_pixmap(bitmap, GINT_TO_POINTER((id & 0xFFFFFF)), userwidth, userheight); | 1888 return _dw_find_private_pixmap(bitmap, GINT_TO_POINTER((id & 0xFFFFFF)), userwidth, userheight); |
1889 | 1889 |
1890 #if GTK_MAJOR_VERSION > 1 | 1890 #if GTK_MAJOR_VERSION > 1 |
1891 icon_pixbuf = _dw_pixbuf_from_resource(id); | 1891 icon_pixbuf = _dw_pixbuf_from_resource(id); |
1892 #endif | 1892 #endif |
1893 | 1893 |
1913 #if GTK_MAJOR_VERSION > 1 | 1913 #if GTK_MAJOR_VERSION > 1 |
1914 icon_pixbuf = _dw_pixbuf_from_data(data); | 1914 icon_pixbuf = _dw_pixbuf_from_data(data); |
1915 #elif defined(USE_IMLIB) | 1915 #elif defined(USE_IMLIB) |
1916 gdk_imlib_data_to_pixmap((char **)data, &icon_pixmap, bitmap); | 1916 gdk_imlib_data_to_pixmap((char **)data, &icon_pixmap, bitmap); |
1917 #else | 1917 #else |
1918 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, bitmap, &_colors[DW_CLR_PALEGRAY], (char **)data); | 1918 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, bitmap, &_dw_colors[DW_CLR_PALEGRAY], (char **)data); |
1919 #endif | 1919 #endif |
1920 } | 1920 } |
1921 } | 1921 } |
1922 #endif | 1922 #endif |
1923 #if GTK_MAJOR_VERSION > 1 | 1923 #if GTK_MAJOR_VERSION > 1 |
1946 #endif | 1946 #endif |
1947 return icon_pixmap; | 1947 return icon_pixmap; |
1948 } | 1948 } |
1949 | 1949 |
1950 #if GTK_MAJOR_VERSION > 1 | 1950 #if GTK_MAJOR_VERSION > 1 |
1951 static GdkPixbuf *_find_private_pixbuf(HICN icon) | 1951 static GdkPixbuf *_dw_find_private_pixbuf(HICN icon) |
1952 { | 1952 { |
1953 int id = GPOINTER_TO_INT(icon); | 1953 int id = GPOINTER_TO_INT(icon); |
1954 | 1954 |
1955 if(id < _PixmapCount && _PixmapArray[id].used) | 1955 if(id < _DWPixmapCount && _DWPixmapArray[id].used) |
1956 return _PixmapArray[id].pixbuf; | 1956 return _DWPixmapArray[id].pixbuf; |
1957 return NULL; | 1957 return NULL; |
1958 } | 1958 } |
1959 | 1959 |
1960 static GdkPixbuf *_find_pixbuf(HICN icon) | 1960 static GdkPixbuf *_dw_find_pixbuf(HICN icon) |
1961 { | 1961 { |
1962 unsigned int id = GPOINTER_TO_INT(icon); | 1962 unsigned int id = GPOINTER_TO_INT(icon); |
1963 GdkPixbuf *icon_pixbuf; | 1963 GdkPixbuf *icon_pixbuf; |
1964 | 1964 |
1965 /* Quick dropout for non-handle */ | 1965 /* Quick dropout for non-handle */ |
1966 if(!icon) | 1966 if(!icon) |
1967 return NULL; | 1967 return NULL; |
1968 | 1968 |
1969 if(id & (1 << 31)) | 1969 if(id & (1 << 31)) |
1970 return _find_private_pixbuf(GINT_TO_POINTER((id & 0xFFFFFF))); | 1970 return _dw_find_private_pixbuf(GINT_TO_POINTER((id & 0xFFFFFF))); |
1971 | 1971 |
1972 if((icon_pixbuf = _dw_pixbuf_from_resource(id))) | 1972 if((icon_pixbuf = _dw_pixbuf_from_resource(id))) |
1973 return icon_pixbuf; | 1973 return icon_pixbuf; |
1974 else | 1974 else |
1975 { | 1975 { |
1993 return NULL; | 1993 return NULL; |
1994 } | 1994 } |
1995 #endif | 1995 #endif |
1996 | 1996 |
1997 #ifdef GDK_WINDOWING_X11 | 1997 #ifdef GDK_WINDOWING_X11 |
1998 static void _size_allocate(GtkWindow *window) | 1998 static void _dw_size_allocate(GtkWindow *window) |
1999 { | 1999 { |
2000 XSizeHints sizehints; | 2000 XSizeHints sizehints; |
2001 | 2001 |
2002 sizehints.base_width = 1; | 2002 sizehints.base_width = 1; |
2003 sizehints.base_height = 1; | 2003 sizehints.base_height = 1; |
2164 gdk_imlib_init(); | 2164 gdk_imlib_init(); |
2165 #endif | 2165 #endif |
2166 /* Add colors to the system colormap */ | 2166 /* Add colors to the system colormap */ |
2167 _dw_cmap = gdk_colormap_get_system(); | 2167 _dw_cmap = gdk_colormap_get_system(); |
2168 for(z=0;z<16;z++) | 2168 for(z=0;z<16;z++) |
2169 gdk_color_alloc(_dw_cmap, &_colors[z]); | 2169 gdk_color_alloc(_dw_cmap, &_dw_colors[z]); |
2170 | 2170 |
2171 pthread_key_create(&_dw_fg_color_key, NULL); | 2171 pthread_key_create(&_dw_fg_color_key, NULL); |
2172 pthread_key_create(&_dw_bg_color_key, NULL); | 2172 pthread_key_create(&_dw_bg_color_key, NULL); |
2173 pthread_key_create(&_dw_mutex_key, NULL); | 2173 pthread_key_create(&_dw_mutex_key, NULL); |
2174 | 2174 |
2190 gdk_imlib_data_to_pixmap((char **)_dw_test_xpm, &_dw_tmppixmap, &_dw_tmpbitmap); | 2190 gdk_imlib_data_to_pixmap((char **)_dw_test_xpm, &_dw_tmppixmap, &_dw_tmpbitmap); |
2191 #else | 2191 #else |
2192 { | 2192 { |
2193 GtkWidget *handle = gtk_label_new(""); | 2193 GtkWidget *handle = gtk_label_new(""); |
2194 gtk_widget_realize(handle); | 2194 gtk_widget_realize(handle); |
2195 _dw_tmppixmap = gdk_pixmap_create_from_xpm_d(handle->window, &_dw_tmpbitmap, &_colors[DW_CLR_PALEGRAY], (char **)_dw_test_xpm); | 2195 _dw_tmppixmap = gdk_pixmap_create_from_xpm_d(handle->window, &_dw_tmpbitmap, &_dw_colors[DW_CLR_PALEGRAY], (char **)_dw_test_xpm); |
2196 gtk_widget_destroy(handle); | 2196 gtk_widget_destroy(handle); |
2197 } | 2197 } |
2198 #endif | 2198 #endif |
2199 | 2199 |
2200 /* | 2200 /* |
2563 gdk_pixbuf_render_pixmap_and_mask(icon_pixbuf, &icon_pixmap, &bitmap, 1); | 2563 gdk_pixbuf_render_pixmap_and_mask(icon_pixbuf, &icon_pixmap, &bitmap, 1); |
2564 g_object_unref(icon_pixbuf); | 2564 g_object_unref(icon_pixbuf); |
2565 #elif defined(USE_IMLIB) | 2565 #elif defined(USE_IMLIB) |
2566 gdk_imlib_data_to_pixmap((char **)xpm_data, &icon_pixmap, &bitmap); | 2566 gdk_imlib_data_to_pixmap((char **)xpm_data, &icon_pixmap, &bitmap); |
2567 #else | 2567 #else |
2568 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], (char **)xpm_data); | 2568 icon_pixmap = gdk_pixmap_create_from_xpm_d(handle->window, &bitmap, &_dw_colors[DW_CLR_PALEGRAY], (char **)xpm_data); |
2569 #endif | 2569 #endif |
2570 | 2570 |
2571 #if GTK_MAJOR_VERSION > 1 | 2571 #if GTK_MAJOR_VERSION > 1 |
2572 gtk_image_set_from_pixmap(GTK_IMAGE(handle), icon_pixmap, bitmap); | 2572 gtk_image_set_from_pixmap(GTK_IMAGE(handle), icon_pixmap, bitmap); |
2573 #else | 2573 #else |
2844 DW_MUTEX_UNLOCK; | 2844 DW_MUTEX_UNLOCK; |
2845 return 0; | 2845 return 0; |
2846 } | 2846 } |
2847 | 2847 |
2848 /* Internal function that changes the attachment properties in a table for destroying. */ | 2848 /* Internal function that changes the attachment properties in a table for destroying. */ |
2849 void _rearrange_table_destroy(GtkWidget *widget, gpointer data) | 2849 void _dw_rearrange_table_destroy(GtkWidget *widget, gpointer data) |
2850 { | 2850 { |
2851 gint pos = GPOINTER_TO_INT(data); | 2851 gint pos = GPOINTER_TO_INT(data); |
2852 GtkContainer *cont = gtk_object_get_data(GTK_OBJECT(widget), "_dw_table"); | 2852 GtkContainer *cont = gtk_object_get_data(GTK_OBJECT(widget), "_dw_table"); |
2853 guint oldpos; | 2853 guint oldpos; |
2854 | 2854 |
2922 | 2922 |
2923 /* If we are destroying the last item in the box this isn't necessary */ | 2923 /* If we are destroying the last item in the box this isn't necessary */ |
2924 if((pos+1) < boxcount) | 2924 if((pos+1) < boxcount) |
2925 { | 2925 { |
2926 /* If we need to contract the table, reposition all the children */ | 2926 /* If we need to contract the table, reposition all the children */ |
2927 gtk_container_forall(GTK_CONTAINER(box),_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); | 2927 gtk_container_forall(GTK_CONTAINER(box),_dw_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); |
2928 } | 2928 } |
2929 | 2929 |
2930 if(boxcount > 0) | 2930 if(boxcount > 0) |
2931 { | 2931 { |
2932 /* Decrease the count by 1 */ | 2932 /* Decrease the count by 1 */ |
2972 DW_MUTEX_LOCK; | 2972 DW_MUTEX_LOCK; |
2973 gdk_window_reparent(GTK_WIDGET(handle)->window, newparent ? GTK_WIDGET(newparent)->window : GDK_ROOT_PARENT(), 0, 0); | 2973 gdk_window_reparent(GTK_WIDGET(handle)->window, newparent ? GTK_WIDGET(newparent)->window : GDK_ROOT_PARENT(), 0, 0); |
2974 DW_MUTEX_UNLOCK; | 2974 DW_MUTEX_UNLOCK; |
2975 } | 2975 } |
2976 | 2976 |
2977 static int _set_font(HWND handle, const char *fontname) | 2977 static int _dw_set_font(HWND handle, const char *fontname) |
2978 { | 2978 { |
2979 int retval = FALSE; | 2979 int retval = FALSE; |
2980 #if GTK_MAJOR_VERSION < 2 | 2980 #if GTK_MAJOR_VERSION < 2 |
2981 GtkStyle *style; | 2981 GtkStyle *style; |
2982 GdkFont *font = NULL; | 2982 GdkFont *font = NULL; |
3003 } | 3003 } |
3004 | 3004 |
3005 static int _dw_font_active = 0; | 3005 static int _dw_font_active = 0; |
3006 | 3006 |
3007 /* Internal function to handle the font OK press */ | 3007 /* Internal function to handle the font OK press */ |
3008 static gint _gtk_font_ok(GtkWidget *widget, DWDialog *dwwait) | 3008 static gint _dw_font_ok(GtkWidget *widget, DWDialog *dwwait) |
3009 { | 3009 { |
3010 GtkFontSelectionDialog *fd; | 3010 GtkFontSelectionDialog *fd; |
3011 char *retfont = NULL; | 3011 char *retfont = NULL; |
3012 gchar *fontname; | 3012 gchar *fontname; |
3013 int len, x; | 3013 int len, x; |
3048 dw_dialog_dismiss(dwwait, (void *)retfont); | 3048 dw_dialog_dismiss(dwwait, (void *)retfont); |
3049 return FALSE; | 3049 return FALSE; |
3050 } | 3050 } |
3051 | 3051 |
3052 /* Internal function to handle the font Cancel press */ | 3052 /* Internal function to handle the font Cancel press */ |
3053 static gint _gtk_font_cancel(GtkWidget *widget, DWDialog *dwwait) | 3053 static gint _dw_font_cancel(GtkWidget *widget, DWDialog *dwwait) |
3054 { | 3054 { |
3055 if(!dwwait) | 3055 if(!dwwait) |
3056 return FALSE; | 3056 return FALSE; |
3057 | 3057 |
3058 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); | 3058 gtk_widget_destroy(GTK_WIDGET(dwwait->data)); |
3108 | 3108 |
3109 _dw_font_active = 1; | 3109 _dw_font_active = 1; |
3110 | 3110 |
3111 dwwait = dw_dialog_new((void *)fd); | 3111 dwwait = dw_dialog_new((void *)fd); |
3112 | 3112 |
3113 g_signal_connect(G_OBJECT(fd->ok_button), "clicked", G_CALLBACK(_gtk_font_ok), dwwait); | 3113 g_signal_connect(G_OBJECT(fd->ok_button), "clicked", G_CALLBACK(_dw_font_ok), dwwait); |
3114 g_signal_connect(G_OBJECT(fd->cancel_button), "clicked", G_CALLBACK(_gtk_font_cancel), dwwait); | 3114 g_signal_connect(G_OBJECT(fd->cancel_button), "clicked", G_CALLBACK(_dw_font_cancel), dwwait); |
3115 | 3115 |
3116 gtk_widget_show(GTK_WIDGET(fd)); | 3116 gtk_widget_show(GTK_WIDGET(fd)); |
3117 | 3117 |
3118 retfont = (char *)dw_dialog_wait(dwwait); | 3118 retfont = (char *)dw_dialog_wait(dwwait); |
3119 DW_MUTEX_UNLOCK; | 3119 DW_MUTEX_UNLOCK; |
3134 if(oldfont) | 3134 if(oldfont) |
3135 free(oldfont); | 3135 free(oldfont); |
3136 } | 3136 } |
3137 | 3137 |
3138 /* Convert DW style font to pango style */ | 3138 /* Convert DW style font to pango style */ |
3139 void _convert_font(char *font) | 3139 void _dw_convert_font(char *font) |
3140 { | 3140 { |
3141 char *name = strchr(font, '.'); | 3141 char *name = strchr(font, '.'); |
3142 | 3142 |
3143 /* Detect Dynamic Windows style font name... | 3143 /* Detect Dynamic Windows style font name... |
3144 * Format: ##.Fontname | 3144 * Format: ##.Fontname |
3212 if(!gdkfont) | 3212 if(!gdkfont) |
3213 gdkfont = gdk_font_load("fixed"); | 3213 gdkfont = gdk_font_load("fixed"); |
3214 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_gdkfont", (gpointer)gdkfont); | 3214 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_gdkfont", (gpointer)gdkfont); |
3215 #else | 3215 #else |
3216 if(font) | 3216 if(font) |
3217 _convert_font(font); | 3217 _dw_convert_font(font); |
3218 #endif | 3218 #endif |
3219 | 3219 |
3220 /* Free old font name if one is allocated */ | 3220 /* Free old font name if one is allocated */ |
3221 data = gtk_object_get_data(GTK_OBJECT(handle2), "_dw_fontname"); | 3221 data = gtk_object_get_data(GTK_OBJECT(handle2), "_dw_fontname"); |
3222 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_fontname", (gpointer)font); | 3222 gtk_object_set_data(GTK_OBJECT(handle2), "_dw_fontname", (gpointer)font); |
3319 #endif | 3319 #endif |
3320 DW_MUTEX_UNLOCK; | 3320 DW_MUTEX_UNLOCK; |
3321 return retfont; | 3321 return retfont; |
3322 } | 3322 } |
3323 | 3323 |
3324 void _free_gdk_colors(HWND handle) | 3324 void _dw_free_gdk_colors(HWND handle) |
3325 { | 3325 { |
3326 GdkColor *old = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_foregdk"); | 3326 GdkColor *old = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_foregdk"); |
3327 | 3327 |
3328 if(old) | 3328 if(old) |
3329 free(old); | 3329 free(old); |
3333 if(old) | 3333 if(old) |
3334 free(old); | 3334 free(old); |
3335 } | 3335 } |
3336 | 3336 |
3337 /* Free old color pointers and allocate new ones */ | 3337 /* Free old color pointers and allocate new ones */ |
3338 static void _save_gdk_colors(HWND handle, GdkColor fore, GdkColor back) | 3338 static void _dw_save_gdk_colors(HWND handle, GdkColor fore, GdkColor back) |
3339 { | 3339 { |
3340 GdkColor *foregdk = malloc(sizeof(GdkColor)); | 3340 GdkColor *foregdk = malloc(sizeof(GdkColor)); |
3341 GdkColor *backgdk = malloc(sizeof(GdkColor)); | 3341 GdkColor *backgdk = malloc(sizeof(GdkColor)); |
3342 | 3342 |
3343 _free_gdk_colors(handle); | 3343 _dw_free_gdk_colors(handle); |
3344 | 3344 |
3345 *foregdk = fore; | 3345 *foregdk = fore; |
3346 *backgdk = back; | 3346 *backgdk = back; |
3347 | 3347 |
3348 gtk_object_set_data(GTK_OBJECT(handle), "_dw_foregdk", (gpointer)foregdk); | 3348 gtk_object_set_data(GTK_OBJECT(handle), "_dw_foregdk", (gpointer)foregdk); |
3349 gtk_object_set_data(GTK_OBJECT(handle), "_dw_backgdk", (gpointer)backgdk); | 3349 gtk_object_set_data(GTK_OBJECT(handle), "_dw_backgdk", (gpointer)backgdk); |
3350 } | 3350 } |
3351 | 3351 |
3352 GdkColor _get_gdkcolor(unsigned long color) | 3352 GdkColor _dw_get_gdkcolor(unsigned long color) |
3353 { | 3353 { |
3354 GdkColor temp = _colors[0]; | 3354 GdkColor temp = _dw_colors[0]; |
3355 | 3355 |
3356 if(color & DW_RGB_COLOR) | 3356 if(color & DW_RGB_COLOR) |
3357 { | 3357 { |
3358 temp.pixel = 0; | 3358 temp.pixel = 0; |
3359 temp.red = DW_RED_VALUE(color) << 8; | 3359 temp.red = DW_RED_VALUE(color) << 8; |
3362 | 3362 |
3363 gdk_color_alloc(_dw_cmap, &temp); | 3363 gdk_color_alloc(_dw_cmap, &temp); |
3364 } | 3364 } |
3365 else if(color < DW_CLR_DEFAULT) | 3365 else if(color < DW_CLR_DEFAULT) |
3366 { | 3366 { |
3367 temp = _colors[color]; | 3367 temp = _dw_colors[color]; |
3368 } | 3368 } |
3369 return temp; | 3369 return temp; |
3370 } | 3370 } |
3371 | 3371 |
3372 static int _set_color(HWND handle, unsigned long fore, unsigned long back) | 3372 static int _dw_set_color(HWND handle, unsigned long fore, unsigned long back) |
3373 { | 3373 { |
3374 /* Remember that each color component in X11 use 16 bit no matter | 3374 /* Remember that each color component in X11 use 16 bit no matter |
3375 * what the destination display supports. (and thus GDK) | 3375 * what the destination display supports. (and thus GDK) |
3376 */ | 3376 */ |
3377 GdkColor forecolor = _get_gdkcolor(fore); | 3377 GdkColor forecolor = _dw_get_gdkcolor(fore); |
3378 GdkColor backcolor = _get_gdkcolor(back); | 3378 GdkColor backcolor = _dw_get_gdkcolor(back); |
3379 #if GTK_MAJOR_VERSION < 2 | 3379 #if GTK_MAJOR_VERSION < 2 |
3380 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle)); | 3380 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(handle)); |
3381 #endif | 3381 #endif |
3382 | 3382 |
3383 #if GTK_MAJOR_VERSION > 1 | 3383 #if GTK_MAJOR_VERSION > 1 |
3397 #else | 3397 #else |
3398 if(back != DW_CLR_DEFAULT && style) | 3398 if(back != DW_CLR_DEFAULT && style) |
3399 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor; | 3399 style->base[0] = style->base[1] = style->bg[0] = style->bg[1] = backcolor; |
3400 #endif | 3400 #endif |
3401 | 3401 |
3402 _save_gdk_colors(handle, forecolor, backcolor); | 3402 _dw_save_gdk_colors(handle, forecolor, backcolor); |
3403 | 3403 |
3404 if(GTK_IS_CLIST(handle)) | 3404 if(GTK_IS_CLIST(handle)) |
3405 { | 3405 { |
3406 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); | 3406 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); |
3407 | 3407 |
3430 unsigned long odd = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_oddcol")); | 3430 unsigned long odd = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_oddcol")); |
3431 unsigned long even = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_evencol")); | 3431 unsigned long even = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_evencol")); |
3432 GdkColor *backcol = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); | 3432 GdkColor *backcol = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); |
3433 | 3433 |
3434 if(!backcol) | 3434 if(!backcol) |
3435 backcol = &_colors[DW_CLR_WHITE]; | 3435 backcol = &_dw_colors[DW_CLR_WHITE]; |
3436 | 3436 |
3437 if(odd != DW_RGB_TRANSPARENT || even != DW_RGB_TRANSPARENT) | 3437 if(odd != DW_RGB_TRANSPARENT || even != DW_RGB_TRANSPARENT) |
3438 { | 3438 { |
3439 GdkColor oddcol = _get_gdkcolor(odd); | 3439 GdkColor oddcol = _dw_get_gdkcolor(odd); |
3440 GdkColor evencol = _get_gdkcolor(even); | 3440 GdkColor evencol = _dw_get_gdkcolor(even); |
3441 | 3441 |
3442 for(z=0;z<rowcount;z++) | 3442 for(z=0;z<rowcount;z++) |
3443 { | 3443 { |
3444 int which = z % 2; | 3444 int which = z % 2; |
3445 | 3445 |
3477 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_eventbox"); | 3477 GtkWidget *tmp = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_eventbox"); |
3478 if(tmp) | 3478 if(tmp) |
3479 handle2 = tmp; | 3479 handle2 = tmp; |
3480 } | 3480 } |
3481 | 3481 |
3482 _set_color(handle2, fore, back); | 3482 _dw_set_color(handle2, fore, back); |
3483 | 3483 |
3484 DW_MUTEX_UNLOCK; | 3484 DW_MUTEX_UNLOCK; |
3485 return TRUE; | 3485 return TRUE; |
3486 } | 3486 } |
3487 | 3487 |
3524 | 3524 |
3525 DW_MUTEX_LOCK; | 3525 DW_MUTEX_LOCK; |
3526 if(pointertype & (1 << 31)) | 3526 if(pointertype & (1 << 31)) |
3527 { | 3527 { |
3528 GdkBitmap *bitmap = NULL; | 3528 GdkBitmap *bitmap = NULL; |
3529 GdkPixmap *pixmap = _find_private_pixmap(&bitmap, GINT_TO_POINTER((pointertype & 0xFFFFFF)), NULL, NULL); | 3529 GdkPixmap *pixmap = _dw_find_private_pixmap(&bitmap, GINT_TO_POINTER((pointertype & 0xFFFFFF)), NULL, NULL); |
3530 cursor = gdk_cursor_new_from_pixmap(pixmap, (GdkPixmap *)bitmap, &_colors[DW_CLR_WHITE], &_colors[DW_CLR_BLACK], 8, 8); | 3530 cursor = gdk_cursor_new_from_pixmap(pixmap, (GdkPixmap *)bitmap, &_dw_colors[DW_CLR_WHITE], &_dw_colors[DW_CLR_BLACK], 8, 8); |
3531 } | 3531 } |
3532 else if(!pointertype) | 3532 else if(!pointertype) |
3533 cursor = NULL; | 3533 cursor = NULL; |
3534 else | 3534 else |
3535 cursor = gdk_cursor_new(pointertype); | 3535 cursor = gdk_cursor_new(pointertype); |
3587 GtkWidget *box = dw_box_new(DW_VERT, 0); | 3587 GtkWidget *box = dw_box_new(DW_VERT, 0); |
3588 GtkWidget *table = gtk_table_new(2, 1, FALSE); | 3588 GtkWidget *table = gtk_table_new(2, 1, FALSE); |
3589 | 3589 |
3590 gtk_widget_show_all(table); | 3590 gtk_widget_show_all(table); |
3591 | 3591 |
3592 last_window = tmp = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 3592 _dw_last_window = tmp = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
3593 | 3593 |
3594 gtk_window_set_title(GTK_WINDOW(tmp), title); | 3594 gtk_window_set_title(GTK_WINDOW(tmp), title); |
3595 gtk_window_set_resizable(GTK_WINDOW(tmp), (flStyle & DW_FCF_SIZEBORDER) ? TRUE : FALSE); | 3595 gtk_window_set_resizable(GTK_WINDOW(tmp), (flStyle & DW_FCF_SIZEBORDER) ? TRUE : FALSE); |
3596 | 3596 |
3597 gtk_widget_realize(tmp); | 3597 gtk_widget_realize(tmp); |
3718 if ( orient == DW_HORZ ) | 3718 if ( orient == DW_HORZ ) |
3719 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); | 3719 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
3720 else | 3720 else |
3721 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); | 3721 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
3722 if (adjustment) | 3722 if (adjustment) |
3723 val = _round_value(adjustment->value); | 3723 val = _dw_round_value(adjustment->value); |
3724 DW_MUTEX_UNLOCK; | 3724 DW_MUTEX_UNLOCK; |
3725 return val; | 3725 return val; |
3726 } | 3726 } |
3727 | 3727 |
3728 /* | 3728 /* |
3744 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); | 3744 adjustment = gtk_scrolled_window_get_hadjustment( GTK_SCROLLED_WINDOW(handle) ); |
3745 else | 3745 else |
3746 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); | 3746 adjustment = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(handle) ); |
3747 if (adjustment) | 3747 if (adjustment) |
3748 { | 3748 { |
3749 range = _round_value(adjustment->upper); | 3749 range = _dw_round_value(adjustment->upper); |
3750 } | 3750 } |
3751 DW_MUTEX_UNLOCK; | 3751 DW_MUTEX_UNLOCK; |
3752 return range; | 3752 return range; |
3753 } | 3753 } |
3754 | 3754 |
3934 *menu = NULL; | 3934 *menu = NULL; |
3935 DW_MUTEX_UNLOCK; | 3935 DW_MUTEX_UNLOCK; |
3936 } | 3936 } |
3937 } | 3937 } |
3938 | 3938 |
3939 char _removetilde(char *dest, const char *src) | 3939 char _dw_removetilde(char *dest, const char *src) |
3940 { | 3940 { |
3941 int z, cur=0; | 3941 int z, cur=0; |
3942 char accel = '\0'; | 3942 char accel = '\0'; |
3943 | 3943 |
3944 for(z=0;z<strlen(src);z++) | 3944 for(z=0;z<strlen(src);z++) |
3982 free(tempbuf); | 3982 free(tempbuf); |
3983 return NULL; | 3983 return NULL; |
3984 } | 3984 } |
3985 | 3985 |
3986 DW_MUTEX_LOCK; | 3986 DW_MUTEX_LOCK; |
3987 accel = _removetilde(tempbuf, title); | 3987 accel = _dw_removetilde(tempbuf, title); |
3988 | 3988 |
3989 accel_group = (GtkAccelGroup *)gtk_object_get_data(GTK_OBJECT(menu), "_dw_accel"); | 3989 accel_group = (GtkAccelGroup *)gtk_object_get_data(GTK_OBJECT(menu), "_dw_accel"); |
3990 submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menu), "_dw_submenucount")); | 3990 submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menu), "_dw_submenucount")); |
3991 | 3991 |
3992 if (strlen(tempbuf) == 0) | 3992 if (strlen(tempbuf) == 0) |
4065 | 4065 |
4066 DW_MUTEX_UNLOCK; | 4066 DW_MUTEX_UNLOCK; |
4067 return tmphandle; | 4067 return tmphandle; |
4068 } | 4068 } |
4069 | 4069 |
4070 GtkWidget *_find_submenu_id(GtkWidget *start, const char *name) | 4070 GtkWidget *_dw_find_submenu_id(GtkWidget *start, const char *name) |
4071 { | 4071 { |
4072 GtkWidget *tmp; | 4072 GtkWidget *tmp; |
4073 int z, submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(start), "_dw_submenucount")); | 4073 int z, submenucount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(start), "_dw_submenucount")); |
4074 | 4074 |
4075 if((tmp = gtk_object_get_data(GTK_OBJECT(start), name))) | 4075 if((tmp = gtk_object_get_data(GTK_OBJECT(start), name))) |
4082 | 4082 |
4083 snprintf(tempbuf, 100, "_dw_submenu%d", z); | 4083 snprintf(tempbuf, 100, "_dw_submenu%d", z); |
4084 | 4084 |
4085 if((submenu = gtk_object_get_data(GTK_OBJECT(start), tempbuf))) | 4085 if((submenu = gtk_object_get_data(GTK_OBJECT(start), tempbuf))) |
4086 { | 4086 { |
4087 if((menuitem = _find_submenu_id(submenu, name))) | 4087 if((menuitem = _dw_find_submenu_id(submenu, name))) |
4088 return menuitem; | 4088 return menuitem; |
4089 } | 4089 } |
4090 } | 4090 } |
4091 return NULL; | 4091 return NULL; |
4092 } | 4092 } |
4108 if(!menu) | 4108 if(!menu) |
4109 return; | 4109 return; |
4110 | 4110 |
4111 DW_MUTEX_LOCK; | 4111 DW_MUTEX_LOCK; |
4112 snprintf(numbuf, 24, "%lu", id); | 4112 snprintf(numbuf, 24, "%lu", id); |
4113 tmphandle = _find_submenu_id(menu, numbuf); | 4113 tmphandle = _dw_find_submenu_id(menu, numbuf); |
4114 | 4114 |
4115 if(tmphandle) | 4115 if(tmphandle) |
4116 { | 4116 { |
4117 _dw_ignore_click = 1; | 4117 _dw_ignore_click = 1; |
4118 if(GTK_CHECK_MENU_ITEM(tmphandle)->active != check) | 4118 if(GTK_CHECK_MENU_ITEM(tmphandle)->active != check) |
4139 if(!menu) | 4139 if(!menu) |
4140 return; | 4140 return; |
4141 | 4141 |
4142 DW_MUTEX_LOCK; | 4142 DW_MUTEX_LOCK; |
4143 snprintf(numbuf, 24, "%lu", id); | 4143 snprintf(numbuf, 24, "%lu", id); |
4144 tmphandle = _find_submenu_id(menu, numbuf); | 4144 tmphandle = _dw_find_submenu_id(menu, numbuf); |
4145 | 4145 |
4146 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) | 4146 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) |
4147 { | 4147 { |
4148 if ( state & DW_MIS_CHECKED ) | 4148 if ( state & DW_MIS_CHECKED ) |
4149 check = 1; | 4149 check = 1; |
4191 if(!menu || !id) | 4191 if(!menu || !id) |
4192 return ret; | 4192 return ret; |
4193 | 4193 |
4194 DW_MUTEX_LOCK; | 4194 DW_MUTEX_LOCK; |
4195 snprintf(numbuf, 24, "%lu", id); | 4195 snprintf(numbuf, 24, "%lu", id); |
4196 tmphandle = _find_submenu_id(menu, numbuf); | 4196 tmphandle = _dw_find_submenu_id(menu, numbuf); |
4197 | 4197 |
4198 if(tmphandle) | 4198 if(tmphandle) |
4199 { | 4199 { |
4200 gtk_widget_destroy(tmphandle); | 4200 gtk_widget_destroy(tmphandle); |
4201 gtk_object_set_data(GTK_OBJECT(menu), numbuf, NULL); | 4201 gtk_object_set_data(GTK_OBJECT(menu), numbuf, NULL); |
4218 int _locked_by_me = FALSE; | 4218 int _locked_by_me = FALSE; |
4219 | 4219 |
4220 if(!menu || !*menu) | 4220 if(!menu || !*menu) |
4221 return; | 4221 return; |
4222 | 4222 |
4223 popup = parent; | 4223 _dw_popup = parent; |
4224 | 4224 |
4225 DW_MUTEX_LOCK; | 4225 DW_MUTEX_LOCK; |
4226 gtk_menu_popup(GTK_MENU(*menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); | 4226 gtk_menu_popup(GTK_MENU(*menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME); |
4227 *menu = NULL; | 4227 *menu = NULL; |
4228 DW_MUTEX_UNLOCK; | 4228 DW_MUTEX_UNLOCK; |
4531 gtk_combo_set_use_arrows(GTK_COMBO(tmp), TRUE); | 4531 gtk_combo_set_use_arrows(GTK_COMBO(tmp), TRUE); |
4532 gtk_object_set_user_data(GTK_OBJECT(tmp), NULL); | 4532 gtk_object_set_user_data(GTK_OBJECT(tmp), NULL); |
4533 gtk_widget_show(tmp); | 4533 gtk_widget_show(tmp); |
4534 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); | 4534 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
4535 | 4535 |
4536 sigid = _set_signal_handler(GTK_COMBO(tmp)->list, tmp, NULL, NULL, NULL); | 4536 sigid = _dw_set_signal_handler(GTK_COMBO(tmp)->list, tmp, NULL, NULL, NULL); |
4537 cid = gtk_signal_connect(GTK_OBJECT(GTK_COMBO(tmp)->list), "select_child", GTK_SIGNAL_FUNC(_item_select_event), GINT_TO_POINTER(sigid)); | 4537 cid = gtk_signal_connect(GTK_OBJECT(GTK_COMBO(tmp)->list), "select_child", GTK_SIGNAL_FUNC(_dw_item_select_event), GINT_TO_POINTER(sigid)); |
4538 _set_signal_handler_id(GTK_COMBO(tmp)->list, sigid, cid); | 4538 _dw_set_signal_handler_id(GTK_COMBO(tmp)->list, sigid, cid); |
4539 if(_DWDefaultFont) | 4539 if(_DWDefaultFont) |
4540 dw_window_set_font(tmp, _DWDefaultFont); | 4540 dw_window_set_font(tmp, _DWDefaultFont); |
4541 DW_MUTEX_UNLOCK; | 4541 DW_MUTEX_UNLOCK; |
4542 return tmp; | 4542 return tmp; |
4543 } | 4543 } |
4795 GTK_WIDGET_UNSET_FLAGS(tmp, GTK_CAN_FOCUS); | 4795 GTK_WIDGET_UNSET_FLAGS(tmp, GTK_CAN_FOCUS); |
4796 gtk_widget_show(tmp); | 4796 gtk_widget_show(tmp); |
4797 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); | 4797 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_adjustment", (gpointer)adjustment); |
4798 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_scrollbar", (gpointer)tmp); | 4798 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_scrollbar", (gpointer)tmp); |
4799 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); | 4799 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
4800 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_suppress_value_changed_event", GINT_TO_POINTER(0)); | 4800 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_suppress_dw_value_changed_event", GINT_TO_POINTER(0)); |
4801 DW_MUTEX_UNLOCK; | 4801 DW_MUTEX_UNLOCK; |
4802 return tmp; | 4802 return tmp; |
4803 } | 4803 } |
4804 | 4804 |
4805 /* | 4805 /* |
4884 GdkBitmap *bitmap = NULL; | 4884 GdkBitmap *bitmap = NULL; |
4885 GdkPixmap *icon_pixmap; | 4885 GdkPixmap *icon_pixmap; |
4886 int _locked_by_me = FALSE; | 4886 int _locked_by_me = FALSE; |
4887 | 4887 |
4888 DW_MUTEX_LOCK; | 4888 DW_MUTEX_LOCK; |
4889 icon_pixmap = _find_pixmap(&bitmap, icon, handle, NULL, NULL); | 4889 icon_pixmap = _dw_find_pixmap(&bitmap, icon, handle, NULL, NULL); |
4890 | 4890 |
4891 if(handle->window && icon_pixmap) | 4891 if(handle->window && icon_pixmap) |
4892 gdk_window_set_icon(handle->window, NULL, icon_pixmap, bitmap); | 4892 gdk_window_set_icon(handle->window, NULL, icon_pixmap, bitmap); |
4893 | 4893 |
4894 DW_MUTEX_UNLOCK; | 4894 DW_MUTEX_UNLOCK; |
4920 return; | 4920 return; |
4921 | 4921 |
4922 DW_MUTEX_LOCK; | 4922 DW_MUTEX_LOCK; |
4923 if(id) | 4923 if(id) |
4924 #if GTK_MAJOR_VERSION > 1 | 4924 #if GTK_MAJOR_VERSION > 1 |
4925 pixbuf = _find_pixbuf((HICN)id); | 4925 pixbuf = _dw_find_pixbuf((HICN)id); |
4926 #else | 4926 #else |
4927 tmp = _find_pixmap(&bitmap, (HICN)id, handle, NULL, NULL); | 4927 tmp = _dw_find_pixmap(&bitmap, (HICN)id, handle, NULL, NULL); |
4928 #endif | 4928 #endif |
4929 else | 4929 else |
4930 { | 4930 { |
4931 char *file = alloca(strlen(filename) + 6); | 4931 char *file = alloca(strlen(filename) + 6); |
4932 #if defined(USE_IMLIB) | 4932 #if defined(USE_IMLIB) |
4946 { | 4946 { |
4947 /* Try with various extentions */ | 4947 /* Try with various extentions */ |
4948 for ( i = 0; i < NUM_EXTS; i++ ) | 4948 for ( i = 0; i < NUM_EXTS; i++ ) |
4949 { | 4949 { |
4950 strcpy( file, filename ); | 4950 strcpy( file, filename ); |
4951 strcat( file, image_exts[i] ); | 4951 strcat( file, _dw_image_exts[i] ); |
4952 if ( access( file, 04 ) == 0 ) | 4952 if ( access( file, 04 ) == 0 ) |
4953 { | 4953 { |
4954 found_ext = 1; | 4954 found_ext = 1; |
4955 break; | 4955 break; |
4956 } | 4956 } |
4968 gdk_imlib_render(image, image->rgb_width, image->rgb_height); | 4968 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
4969 tmp = gdk_imlib_copy_image(image); | 4969 tmp = gdk_imlib_copy_image(image); |
4970 bitmap = gdk_imlib_copy_mask(image); | 4970 bitmap = gdk_imlib_copy_mask(image); |
4971 gdk_imlib_destroy_image(image); | 4971 gdk_imlib_destroy_image(image); |
4972 #else | 4972 #else |
4973 tmp = gdk_pixmap_create_from_xpm(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], file); | 4973 tmp = gdk_pixmap_create_from_xpm(handle->window, &bitmap, &_dw_colors[DW_CLR_PALEGRAY], file); |
4974 #endif | 4974 #endif |
4975 } | 4975 } |
4976 | 4976 |
4977 #if GTK_MAJOR_VERSION > 1 | 4977 #if GTK_MAJOR_VERSION > 1 |
4978 if (pixbuf) | 4978 if (pixbuf) |
5064 gdk_imlib_render(image, image->rgb_width, image->rgb_height); | 5064 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
5065 tmp = gdk_imlib_copy_image(image); | 5065 tmp = gdk_imlib_copy_image(image); |
5066 bitmap = gdk_imlib_copy_mask(image); | 5066 bitmap = gdk_imlib_copy_mask(image); |
5067 gdk_imlib_destroy_image(image); | 5067 gdk_imlib_destroy_image(image); |
5068 #else | 5068 #else |
5069 tmp = gdk_pixmap_create_from_xpm_d(handle->window, &bitmap, &_colors[DW_CLR_PALEGRAY], mydata); | 5069 tmp = gdk_pixmap_create_from_xpm_d(handle->window, &bitmap, &_dw_colors[DW_CLR_PALEGRAY], mydata); |
5070 #endif | 5070 #endif |
5071 /* remove our temporary file */ | 5071 /* remove our temporary file */ |
5072 unlink(template); | 5072 unlink(template); |
5073 } | 5073 } |
5074 else if (id) | 5074 else if (id) |
5075 #if GTK_MAJOR_VERSION > 1 | 5075 #if GTK_MAJOR_VERSION > 1 |
5076 pixbuf = _find_pixbuf((HICN)id); | 5076 pixbuf = _dw_find_pixbuf((HICN)id); |
5077 #else | 5077 #else |
5078 tmp = _find_pixmap(&bitmap, (HICN)id, handle, NULL, NULL); | 5078 tmp = _dw_find_pixmap(&bitmap, (HICN)id, handle, NULL, NULL); |
5079 #endif | 5079 #endif |
5080 | 5080 |
5081 #if GTK_MAJOR_VERSION > 1 | 5081 #if GTK_MAJOR_VERSION > 1 |
5082 if (pixbuf) | 5082 if (pixbuf) |
5083 #else | 5083 #else |
5945 | 5945 |
5946 DW_MUTEX_LOCK; | 5946 DW_MUTEX_LOCK; |
5947 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); | 5947 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
5948 if(adjustment) | 5948 if(adjustment) |
5949 { | 5949 { |
5950 int max = _round_value(adjustment->upper) - 1; | 5950 int max = _dw_round_value(adjustment->upper) - 1; |
5951 int thisval = _round_value(adjustment->value); | 5951 int thisval = _dw_round_value(adjustment->value); |
5952 | 5952 |
5953 if(GTK_IS_VSCALE(handle)) | 5953 if(GTK_IS_VSCALE(handle)) |
5954 val = max - thisval; | 5954 val = max - thisval; |
5955 else | 5955 else |
5956 val = thisval; | 5956 val = thisval; |
5975 | 5975 |
5976 DW_MUTEX_LOCK; | 5976 DW_MUTEX_LOCK; |
5977 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); | 5977 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
5978 if(adjustment) | 5978 if(adjustment) |
5979 { | 5979 { |
5980 int max = _round_value(adjustment->upper) - 1; | 5980 int max = _dw_round_value(adjustment->upper) - 1; |
5981 | 5981 |
5982 if(GTK_IS_VSCALE(handle)) | 5982 if(GTK_IS_VSCALE(handle)) |
5983 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); | 5983 gtk_adjustment_set_value(adjustment, (gfloat)(max - position)); |
5984 else | 5984 else |
5985 gtk_adjustment_set_value(adjustment, (gfloat)position); | 5985 gtk_adjustment_set_value(adjustment, (gfloat)position); |
6001 return 0; | 6001 return 0; |
6002 | 6002 |
6003 DW_MUTEX_LOCK; | 6003 DW_MUTEX_LOCK; |
6004 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); | 6004 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
6005 if(adjustment) | 6005 if(adjustment) |
6006 val = _round_value(adjustment->value); | 6006 val = _dw_round_value(adjustment->value); |
6007 DW_MUTEX_UNLOCK; | 6007 DW_MUTEX_UNLOCK; |
6008 return val; | 6008 return val; |
6009 } | 6009 } |
6010 | 6010 |
6011 /* | 6011 /* |
6024 | 6024 |
6025 DW_MUTEX_LOCK; | 6025 DW_MUTEX_LOCK; |
6026 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); | 6026 adjustment = (GtkAdjustment *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_adjustment"); |
6027 if(adjustment) | 6027 if(adjustment) |
6028 { | 6028 { |
6029 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_suppress_value_changed_event", GINT_TO_POINTER(1)); | 6029 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_suppress_dw_value_changed_event", GINT_TO_POINTER(1)); |
6030 gtk_adjustment_set_value(adjustment, (gfloat)position); | 6030 gtk_adjustment_set_value(adjustment, (gfloat)position); |
6031 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_suppress_value_changed_event", GINT_TO_POINTER(0)); | 6031 gtk_object_set_data(GTK_OBJECT(adjustment), "_dw_suppress_dw_value_changed_event", GINT_TO_POINTER(0)); |
6032 } | 6032 } |
6033 DW_MUTEX_UNLOCK; | 6033 DW_MUTEX_UNLOCK; |
6034 } | 6034 } |
6035 | 6035 |
6036 /* | 6036 /* |
6190 && GTK_IS_TREE_VIEW(tree) && | 6190 && GTK_IS_TREE_VIEW(tree) && |
6191 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) | 6191 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
6192 { | 6192 { |
6193 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); | 6193 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
6194 | 6194 |
6195 pixbuf = _find_pixbuf(icon); | 6195 pixbuf = _dw_find_pixbuf(icon); |
6196 | 6196 |
6197 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); | 6197 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); |
6198 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); | 6198 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
6199 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) | 6199 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) |
6200 g_object_unref(pixbuf); | 6200 g_object_unref(pixbuf); |
6232 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_itemdata", (gpointer)itemdata); | 6232 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_itemdata", (gpointer)itemdata); |
6233 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_tree", (gpointer)tree); | 6233 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_tree", (gpointer)tree); |
6234 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_parent", (gpointer)parent); | 6234 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_parent", (gpointer)parent); |
6235 hbox = gtk_hbox_new(FALSE, 2); | 6235 hbox = gtk_hbox_new(FALSE, 2); |
6236 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_hbox", (gpointer)hbox); | 6236 gtk_object_set_data(GTK_OBJECT(newitem), "_dw_hbox", (gpointer)hbox); |
6237 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); | 6237 gdkpix = _dw_find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
6238 gtk_container_add(GTK_CONTAINER(newitem), hbox); | 6238 gtk_container_add(GTK_CONTAINER(newitem), hbox); |
6239 if(gdkpix) | 6239 if(gdkpix) |
6240 { | 6240 { |
6241 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); | 6241 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
6242 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); | 6242 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
6248 | 6248 |
6249 { | 6249 { |
6250 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); | 6250 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); |
6251 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); | 6251 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); |
6252 void **params = calloc(sizeof(void *), 3): | 6252 void **params = calloc(sizeof(void *), 3): |
6253 SignalHandler work; | 6253 DWSignalHandler work; |
6254 | 6254 |
6255 params[0] = mydata; | 6255 params[0] = mydata; |
6256 params[2] = (void *)tree; | 6256 params[2] = (void *)tree; |
6257 work = _get_signal_handler(mydata); | 6257 work = _dw_get_signal_handler(mydata); |
6258 | 6258 |
6259 if(thisfunc && work.window) | 6259 if(thisfunc && work.window) |
6260 { | 6260 { |
6261 gint sigid = _set_signal_handler(newitem, work.window, work.func, work.data, thisfunc); | 6261 gint sigid = _dw_set_signal_handler(newitem, work.window, work.func, work.data, thisfunc); |
6262 pointer[0] = GINT_TO_POINTER(sigid); | 6262 pointer[0] = GINT_TO_POINTER(sigid); |
6263 gint cid = g_signal_connect_data(G_OBJECT(newitem), "expand", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 6263 gint cid = g_signal_connect_data(G_OBJECT(newitem), "expand", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
6264 _set_signal_handler_id(newitem, sigid, cid); | 6264 _dw_set_signal_handler_id(newitem, sigid, cid); |
6265 } | 6265 } |
6266 else | 6266 else |
6267 { | 6267 { |
6268 free(params); | 6268 free(params); |
6269 } | 6269 } |
6275 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); | 6275 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); |
6276 if(!subtree || !GTK_IS_TREE(subtree)) | 6276 if(!subtree || !GTK_IS_TREE(subtree)) |
6277 { | 6277 { |
6278 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); | 6278 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); |
6279 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); | 6279 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); |
6280 SignalHandler work = _get_signal_handler(mydata); | 6280 DWSignalHandler work = _dw_get_signal_handler(mydata); |
6281 | 6281 |
6282 subtree = gtk_tree_new(); | 6282 subtree = gtk_tree_new(); |
6283 | 6283 |
6284 if(thisfunc && work.window) | 6284 if(thisfunc && work.window) |
6285 { | 6285 { |
6286 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); | 6286 int sigid = _dw_set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
6287 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); | 6287 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
6288 _set_signal_handler_id(subtree, sigid, cid); | 6288 _dw_set_signal_handler_id(subtree, sigid, cid); |
6289 } | 6289 } |
6290 | 6290 |
6291 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); | 6291 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); |
6292 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); | 6292 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); |
6293 work = _get_signal_handler(mydata); | 6293 work = _dw_get_signal_handler(mydata); |
6294 | 6294 |
6295 if(thisfunc && work.window) | 6295 if(thisfunc && work.window) |
6296 { | 6296 { |
6297 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); | 6297 int sigid = _dw_set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
6298 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); | 6298 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
6299 _set_signal_handler_id(subtree, sigid, cid); | 6299 _dw_set_signal_handler_id(subtree, sigid, cid); |
6300 } | 6300 } |
6301 | 6301 |
6302 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); | 6302 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); |
6303 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); | 6303 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); |
6304 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); | 6304 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); |
6353 && GTK_IS_TREE_VIEW(tree) && | 6353 && GTK_IS_TREE_VIEW(tree) && |
6354 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) | 6354 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
6355 { | 6355 { |
6356 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); | 6356 iter = (GtkTreeIter *)malloc(sizeof(GtkTreeIter)); |
6357 | 6357 |
6358 pixbuf = _find_pixbuf(icon); | 6358 pixbuf = _dw_find_pixbuf(icon); |
6359 | 6359 |
6360 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); | 6360 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); |
6361 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); | 6361 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); |
6362 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) | 6362 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) |
6363 g_object_unref(pixbuf); | 6363 g_object_unref(pixbuf); |
6388 gtk_object_set_data(GTK_OBJECT(item), "_dw_itemdata", (gpointer)itemdata); | 6388 gtk_object_set_data(GTK_OBJECT(item), "_dw_itemdata", (gpointer)itemdata); |
6389 gtk_object_set_data(GTK_OBJECT(item), "_dw_tree", (gpointer)tree); | 6389 gtk_object_set_data(GTK_OBJECT(item), "_dw_tree", (gpointer)tree); |
6390 gtk_object_set_data(GTK_OBJECT(item), "_dw_parent", (gpointer)parent); | 6390 gtk_object_set_data(GTK_OBJECT(item), "_dw_parent", (gpointer)parent); |
6391 hbox = gtk_hbox_new(FALSE, 2); | 6391 hbox = gtk_hbox_new(FALSE, 2); |
6392 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); | 6392 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); |
6393 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); | 6393 gdkpix = _dw_find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
6394 gtk_container_add(GTK_CONTAINER(item), hbox); | 6394 gtk_container_add(GTK_CONTAINER(item), hbox); |
6395 if(gdkpix) | 6395 if(gdkpix) |
6396 { | 6396 { |
6397 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); | 6397 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
6398 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); | 6398 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
6404 | 6404 |
6405 { | 6405 { |
6406 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); | 6406 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_func"); |
6407 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); | 6407 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_item_expand_data"); |
6408 void **params = calloc(sizeof(void *), 3): | 6408 void **params = calloc(sizeof(void *), 3): |
6409 SignalHandler work; | 6409 DWSignalHandler work; |
6410 | 6410 |
6411 params[0] = mydata; | 6411 params[0] = mydata; |
6412 params[2] = (void *)tree; | 6412 params[2] = (void *)tree; |
6413 work = _get_signal_handler(mydata); | 6413 work = _dw_get_signal_handler(mydata); |
6414 | 6414 |
6415 if(thisfunc && work.window) | 6415 if(thisfunc && work.window) |
6416 { | 6416 { |
6417 gint sigid = _set_signal_handler(item, work.window, work.func, work.data, thisfunc); | 6417 gint sigid = _dw_set_signal_handler(item, work.window, work.func, work.data, thisfunc); |
6418 params[0] = GINT_TO_POINTER(sigid); | 6418 params[0] = GINT_TO_POINTER(sigid); |
6419 gint cid = g_signal_connect_data(G_OBJECT(item), "expand", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 6419 gint cid = g_signal_connect_data(G_OBJECT(item), "expand", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
6420 _set_signal_handler_id(item, sigid, cid); | 6420 _dw_set_signal_handler_id(item, sigid, cid); |
6421 } | 6421 } |
6422 } | 6422 } |
6423 | 6423 |
6424 _dw_ignore_expand = 1; | 6424 _dw_ignore_expand = 1; |
6425 if(parent) | 6425 if(parent) |
6427 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); | 6427 subtree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(parent)); |
6428 if(!subtree || !GTK_IS_TREE(subtree)) | 6428 if(!subtree || !GTK_IS_TREE(subtree)) |
6429 { | 6429 { |
6430 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); | 6430 void *thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_func"); |
6431 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); | 6431 void *mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_select_child_data"); |
6432 SignalHandler work = _get_signal_handler(mydata); | 6432 DWSignalHandler work = _dw_get_signal_handler(mydata); |
6433 | 6433 |
6434 subtree = gtk_tree_new(); | 6434 subtree = gtk_tree_new(); |
6435 | 6435 |
6436 if(thisfunc && work.window) | 6436 if(thisfunc && work.window) |
6437 { | 6437 { |
6438 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); | 6438 int sigid = _dw_set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
6439 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); | 6439 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "select-child", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
6440 _set_signal_handler_id(subtree, sigid, cid); | 6440 _dw_set_signal_handler_id(subtree, sigid, cid); |
6441 } | 6441 } |
6442 | 6442 |
6443 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); | 6443 thisfunc = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_func"); |
6444 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); | 6444 mydata = (void *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_container_context_data"); |
6445 work = _get_signal_handler(mydata); | 6445 work = _dw_get_signal_handler(mydata); |
6446 | 6446 |
6447 if(thisfunc && work.window) | 6447 if(thisfunc && work.window) |
6448 { | 6448 { |
6449 int sigid = _set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); | 6449 int sigid = _dw_set_signal_handler(subtree, work.window, work.func, work.data, thisfunc); |
6450 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); | 6450 gint cid =gtk_signal_connect(GTK_OBJECT(subtree), "button_press_event", GTK_SIGNAL_FUNC(thisfunc),(gpointer)sigid); |
6451 _set_signal_handler_id(subtree, sigid, cid); | 6451 _dw_set_signal_handler_id(subtree, sigid, cid); |
6452 } | 6452 } |
6453 | 6453 |
6454 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); | 6454 gtk_object_set_user_data(GTK_OBJECT(parent), subtree); |
6455 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); | 6455 gtk_tree_set_selection_mode(GTK_TREE(subtree), GTK_SELECTION_SINGLE); |
6456 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); | 6456 gtk_tree_set_view_mode(GTK_TREE(subtree), GTK_TREE_VIEW_ITEM); |
6500 DW_MUTEX_LOCK; | 6500 DW_MUTEX_LOCK; |
6501 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) | 6501 if((tree = (GtkWidget *)gtk_object_get_user_data(GTK_OBJECT(handle))) |
6502 && GTK_IS_TREE_VIEW(tree) && | 6502 && GTK_IS_TREE_VIEW(tree) && |
6503 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) | 6503 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) |
6504 { | 6504 { |
6505 pixbuf = _find_pixbuf(icon); | 6505 pixbuf = _dw_find_pixbuf(icon); |
6506 | 6506 |
6507 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); | 6507 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); |
6508 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) | 6508 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31))) |
6509 g_object_unref(pixbuf); | 6509 g_object_unref(pixbuf); |
6510 } | 6510 } |
6527 gtk_object_set_data(GTK_OBJECT(item), "_dw_text", (gpointer)strdup(title)); | 6527 gtk_object_set_data(GTK_OBJECT(item), "_dw_text", (gpointer)strdup(title)); |
6528 hbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_hbox"); | 6528 hbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_hbox"); |
6529 gtk_widget_destroy(hbox); | 6529 gtk_widget_destroy(hbox); |
6530 hbox = gtk_hbox_new(FALSE, 2); | 6530 hbox = gtk_hbox_new(FALSE, 2); |
6531 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); | 6531 gtk_object_set_data(GTK_OBJECT(item), "_dw_hbox", (gpointer)hbox); |
6532 gdkpix = _find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); | 6532 gdkpix = _dw_find_pixmap(&gdkbmp, icon, hbox, NULL, NULL); |
6533 gtk_container_add(GTK_CONTAINER(item), hbox); | 6533 gtk_container_add(GTK_CONTAINER(item), hbox); |
6534 if(gdkpix) | 6534 if(gdkpix) |
6535 { | 6535 { |
6536 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); | 6536 pixmap = gtk_pixmap_new(gdkpix, gdkbmp); |
6537 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); | 6537 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, TRUE, 0); |
7073 return (HICN)id; | 7073 return (HICN)id; |
7074 } | 7074 } |
7075 | 7075 |
7076 #if GTK_MAJOR_VERSION > 1 | 7076 #if GTK_MAJOR_VERSION > 1 |
7077 /* Internal function to keep HICNs from getting too big */ | 7077 /* Internal function to keep HICNs from getting too big */ |
7078 GdkPixbuf *_icon_resize(GdkPixbuf *ret) | 7078 GdkPixbuf *_dw_icon_resize(GdkPixbuf *ret) |
7079 { | 7079 { |
7080 if(ret) | 7080 if(ret) |
7081 { | 7081 { |
7082 int pwidth = gdk_pixbuf_get_width(ret); | 7082 int pwidth = gdk_pixbuf_get_width(ret); |
7083 int pheight = gdk_pixbuf_get_height(ret); | 7083 int pheight = gdk_pixbuf_get_height(ret); |
7123 { | 7123 { |
7124 /* Try with various extentions */ | 7124 /* Try with various extentions */ |
7125 for ( i = 0; i < NUM_EXTS; i++ ) | 7125 for ( i = 0; i < NUM_EXTS; i++ ) |
7126 { | 7126 { |
7127 strcpy( file, filename ); | 7127 strcpy( file, filename ); |
7128 strcat( file, image_exts[i] ); | 7128 strcat( file, _dw_image_exts[i] ); |
7129 if ( access( file, 04 ) == 0 ) | 7129 if ( access( file, 04 ) == 0 ) |
7130 { | 7130 { |
7131 found_ext = 1; | 7131 found_ext = 1; |
7132 break; | 7132 break; |
7133 } | 7133 } |
7138 } | 7138 } |
7139 } | 7139 } |
7140 | 7140 |
7141 DW_MUTEX_LOCK; | 7141 DW_MUTEX_LOCK; |
7142 /* Find a free entry in the array */ | 7142 /* Find a free entry in the array */ |
7143 for (z=0;z<_PixmapCount;z++) | 7143 for (z=0;z<_DWPixmapCount;z++) |
7144 { | 7144 { |
7145 if (!_PixmapArray[z].used) | 7145 if (!_DWPixmapArray[z].used) |
7146 { | 7146 { |
7147 ret = found = z; | 7147 ret = found = z; |
7148 break; | 7148 break; |
7149 } | 7149 } |
7150 } | 7150 } |
7152 /* If there are no free entries, expand the | 7152 /* If there are no free entries, expand the |
7153 * array. | 7153 * array. |
7154 */ | 7154 */ |
7155 if (found == -1) | 7155 if (found == -1) |
7156 { | 7156 { |
7157 DWPrivatePixmap *old = _PixmapArray; | 7157 DWPrivatePixmap *old = _DWPixmapArray; |
7158 | 7158 |
7159 ret = found = _PixmapCount; | 7159 ret = found = _DWPixmapCount; |
7160 _PixmapCount++; | 7160 _DWPixmapCount++; |
7161 | 7161 |
7162 _PixmapArray = malloc(sizeof(DWPrivatePixmap) * _PixmapCount); | 7162 _DWPixmapArray = malloc(sizeof(DWPrivatePixmap) * _DWPixmapCount); |
7163 | 7163 |
7164 if (found) | 7164 if (found) |
7165 memcpy(_PixmapArray, old, sizeof(DWPrivatePixmap) * found); | 7165 memcpy(_DWPixmapArray, old, sizeof(DWPrivatePixmap) * found); |
7166 if (old) | 7166 if (old) |
7167 free(old); | 7167 free(old); |
7168 _PixmapArray[found].used = 1; | 7168 _DWPixmapArray[found].used = 1; |
7169 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; | 7169 _DWPixmapArray[found].pixmap = _DWPixmapArray[found].mask = NULL; |
7170 } | 7170 } |
7171 | 7171 |
7172 #if GTK_MAJOR_VERSION > 1 | 7172 #if GTK_MAJOR_VERSION > 1 |
7173 pixbuf = _icon_resize(gdk_pixbuf_new_from_file(file, NULL)); | 7173 pixbuf = _dw_icon_resize(gdk_pixbuf_new_from_file(file, NULL)); |
7174 if (pixbuf) | 7174 if (pixbuf) |
7175 { | 7175 { |
7176 _PixmapArray[found].pixbuf = pixbuf; | 7176 _DWPixmapArray[found].pixbuf = pixbuf; |
7177 _PixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); | 7177 _DWPixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); |
7178 _PixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); | 7178 _DWPixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); |
7179 | 7179 |
7180 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_PixmapArray[found].pixmap, &_PixmapArray[found].mask, 1); | 7180 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_DWPixmapArray[found].pixmap, &_DWPixmapArray[found].mask, 1); |
7181 } | 7181 } |
7182 #elif defined(USE_IMLIB) | 7182 #elif defined(USE_IMLIB) |
7183 image = gdk_imlib_load_image(file); | 7183 image = gdk_imlib_load_image(file); |
7184 if (image) | 7184 if (image) |
7185 { | 7185 { |
7186 _PixmapArray[found].width = image->rgb_width; | 7186 _DWPixmapArray[found].width = image->rgb_width; |
7187 _PixmapArray[found].height = image->rgb_height; | 7187 _DWPixmapArray[found].height = image->rgb_height; |
7188 | 7188 |
7189 gdk_imlib_render(image, image->rgb_width, image->rgb_height); | 7189 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
7190 _PixmapArray[found].pixmap = gdk_imlib_copy_image(image); | 7190 _DWPixmapArray[found].pixmap = gdk_imlib_copy_image(image); |
7191 _PixmapArray[found].mask = gdk_imlib_copy_mask(image); | 7191 _DWPixmapArray[found].mask = gdk_imlib_copy_mask(image); |
7192 gdk_imlib_destroy_image(image); | 7192 gdk_imlib_destroy_image(image); |
7193 } | 7193 } |
7194 #else | 7194 #else |
7195 if (last_window) | 7195 if (_dw_last_window) |
7196 _PixmapArray[found].pixmap = gdk_pixmap_create_from_xpm(last_window->window, &_PixmapArray[found].mask, &_colors[DW_CLR_PALEGRAY], file); | 7196 _DWPixmapArray[found].pixmap = gdk_pixmap_create_from_xpm(_dw_last_window->window, &_DWPixmapArray[found].mask, &_dw_colors[DW_CLR_PALEGRAY], file); |
7197 #endif | 7197 #endif |
7198 DW_MUTEX_UNLOCK; | 7198 DW_MUTEX_UNLOCK; |
7199 if (!_PixmapArray[found].pixmap || !_PixmapArray[found].mask) | 7199 if (!_DWPixmapArray[found].pixmap || !_DWPixmapArray[found].mask) |
7200 { | 7200 { |
7201 _PixmapArray[found].used = 0; | 7201 _DWPixmapArray[found].used = 0; |
7202 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; | 7202 _DWPixmapArray[found].pixmap = _DWPixmapArray[found].mask = NULL; |
7203 return 0; | 7203 return 0; |
7204 } | 7204 } |
7205 return (HICN)(ret | (1 << 31)); | 7205 return (HICN)(ret | (1 << 31)); |
7206 } | 7206 } |
7207 | 7207 |
7235 /* Bail if we couldn't write full file */ | 7235 /* Bail if we couldn't write full file */ |
7236 if(fd == -1 || written != len) | 7236 if(fd == -1 || written != len) |
7237 return 0; | 7237 return 0; |
7238 | 7238 |
7239 /* Find a free entry in the array */ | 7239 /* Find a free entry in the array */ |
7240 for(z=0;z<_PixmapCount;z++) | 7240 for(z=0;z<_DWPixmapCount;z++) |
7241 { | 7241 { |
7242 if(!_PixmapArray[z].used) | 7242 if(!_DWPixmapArray[z].used) |
7243 { | 7243 { |
7244 ret = found = z; | 7244 ret = found = z; |
7245 break; | 7245 break; |
7246 } | 7246 } |
7247 } | 7247 } |
7249 /* If there are no free entries, expand the | 7249 /* If there are no free entries, expand the |
7250 * array. | 7250 * array. |
7251 */ | 7251 */ |
7252 if(found == -1) | 7252 if(found == -1) |
7253 { | 7253 { |
7254 DWPrivatePixmap *old = _PixmapArray; | 7254 DWPrivatePixmap *old = _DWPixmapArray; |
7255 | 7255 |
7256 ret = found = _PixmapCount; | 7256 ret = found = _DWPixmapCount; |
7257 _PixmapCount++; | 7257 _DWPixmapCount++; |
7258 | 7258 |
7259 _PixmapArray = malloc(sizeof(DWPrivatePixmap) * _PixmapCount); | 7259 _DWPixmapArray = malloc(sizeof(DWPrivatePixmap) * _DWPixmapCount); |
7260 | 7260 |
7261 if (found) | 7261 if (found) |
7262 memcpy(_PixmapArray, old, sizeof(DWPrivatePixmap) * found); | 7262 memcpy(_DWPixmapArray, old, sizeof(DWPrivatePixmap) * found); |
7263 if (old) | 7263 if (old) |
7264 free(old); | 7264 free(old); |
7265 _PixmapArray[found].used = 1; | 7265 _DWPixmapArray[found].used = 1; |
7266 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; | 7266 _DWPixmapArray[found].pixmap = _DWPixmapArray[found].mask = NULL; |
7267 } | 7267 } |
7268 | 7268 |
7269 #if GTK_MAJOR_VERSION > 1 | 7269 #if GTK_MAJOR_VERSION > 1 |
7270 pixbuf = _icon_resize(gdk_pixbuf_new_from_file(template, NULL)); | 7270 pixbuf = _dw_icon_resize(gdk_pixbuf_new_from_file(template, NULL)); |
7271 | 7271 |
7272 if(pixbuf) | 7272 if(pixbuf) |
7273 { | 7273 { |
7274 _PixmapArray[found].pixbuf = pixbuf; | 7274 _DWPixmapArray[found].pixbuf = pixbuf; |
7275 _PixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); | 7275 _DWPixmapArray[found].width = gdk_pixbuf_get_width(pixbuf); |
7276 _PixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); | 7276 _DWPixmapArray[found].height = gdk_pixbuf_get_height(pixbuf); |
7277 | 7277 |
7278 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_PixmapArray[found].pixmap, &_PixmapArray[found].mask, 1); | 7278 gdk_pixbuf_render_pixmap_and_mask(pixbuf, &_DWPixmapArray[found].pixmap, &_DWPixmapArray[found].mask, 1); |
7279 } | 7279 } |
7280 #elif defined(USE_IMLIB) | 7280 #elif defined(USE_IMLIB) |
7281 image = gdk_imlib_load_image(template); | 7281 image = gdk_imlib_load_image(template); |
7282 | 7282 |
7283 if(image) | 7283 if(image) |
7284 { | 7284 { |
7285 _PixmapArray[found].width = image->rgb_width; | 7285 _DWPixmapArray[found].width = image->rgb_width; |
7286 _PixmapArray[found].height = image->rgb_height; | 7286 _DWPixmapArray[found].height = image->rgb_height; |
7287 | 7287 |
7288 gdk_imlib_render(image, image->rgb_width, image->rgb_height); | 7288 gdk_imlib_render(image, image->rgb_width, image->rgb_height); |
7289 _PixmapArray[found].pixmap = gdk_imlib_copy_image(image); | 7289 _DWPixmapArray[found].pixmap = gdk_imlib_copy_image(image); |
7290 _PixmapArray[found].mask = gdk_imlib_copy_mask(image); | 7290 _DWPixmapArray[found].mask = gdk_imlib_copy_mask(image); |
7291 gdk_imlib_destroy_image(image); | 7291 gdk_imlib_destroy_image(image); |
7292 } | 7292 } |
7293 #else | 7293 #else |
7294 if(last_window) | 7294 if(_dw_last_window) |
7295 _PixmapArray[found].pixmap = gdk_pixmap_create_from_xpm_d(last_window->window, &_PixmapArray[found].mask, &_colors[DW_CLR_PALEGRAY], data); | 7295 _DWPixmapArray[found].pixmap = gdk_pixmap_create_from_xpm_d(_dw_last_window->window, &_DWPixmapArray[found].mask, &_dw_colors[DW_CLR_PALEGRAY], data); |
7296 #endif | 7296 #endif |
7297 /* remove our temporary file */ | 7297 /* remove our temporary file */ |
7298 unlink(template); | 7298 unlink(template); |
7299 DW_MUTEX_UNLOCK; | 7299 DW_MUTEX_UNLOCK; |
7300 if(!_PixmapArray[found].pixmap || !_PixmapArray[found].mask) | 7300 if(!_DWPixmapArray[found].pixmap || !_DWPixmapArray[found].mask) |
7301 { | 7301 { |
7302 _PixmapArray[found].used = 0; | 7302 _DWPixmapArray[found].used = 0; |
7303 _PixmapArray[found].pixmap = _PixmapArray[found].mask = NULL; | 7303 _DWPixmapArray[found].pixmap = _DWPixmapArray[found].mask = NULL; |
7304 return 0; | 7304 return 0; |
7305 } | 7305 } |
7306 return (HICN)(ret | (1 << 31)); | 7306 return (HICN)(ret | (1 << 31)); |
7307 } | 7307 } |
7308 | 7308 |
7319 */ | 7319 */ |
7320 if(GPOINTER_TO_INT(handle) & (1 << 31)) | 7320 if(GPOINTER_TO_INT(handle) & (1 << 31)) |
7321 { | 7321 { |
7322 unsigned long id = GPOINTER_TO_INT(handle) & 0xFFFFFF; | 7322 unsigned long id = GPOINTER_TO_INT(handle) & 0xFFFFFF; |
7323 | 7323 |
7324 if(id < _PixmapCount && _PixmapArray[id].used) | 7324 if(id < _DWPixmapCount && _DWPixmapArray[id].used) |
7325 { | 7325 { |
7326 #if GTK_MAJOR_VERSION > 1 | 7326 #if GTK_MAJOR_VERSION > 1 |
7327 if(_PixmapArray[id].pixbuf) | 7327 if(_DWPixmapArray[id].pixbuf) |
7328 { | 7328 { |
7329 g_object_unref(_PixmapArray[id].pixbuf); | 7329 g_object_unref(_DWPixmapArray[id].pixbuf); |
7330 _PixmapArray[id].pixbuf = NULL; | 7330 _DWPixmapArray[id].pixbuf = NULL; |
7331 } | 7331 } |
7332 #endif | 7332 #endif |
7333 if(_PixmapArray[id].mask) | 7333 if(_DWPixmapArray[id].mask) |
7334 { | 7334 { |
7335 gdk_bitmap_unref(_PixmapArray[id].mask); | 7335 gdk_bitmap_unref(_DWPixmapArray[id].mask); |
7336 _PixmapArray[id].mask = NULL; | 7336 _DWPixmapArray[id].mask = NULL; |
7337 } | 7337 } |
7338 if(_PixmapArray[id].pixmap) | 7338 if(_DWPixmapArray[id].pixmap) |
7339 { | 7339 { |
7340 gdk_pixmap_unref(_PixmapArray[id].pixmap); | 7340 gdk_pixmap_unref(_DWPixmapArray[id].pixmap); |
7341 _PixmapArray[id].pixmap = NULL; | 7341 _DWPixmapArray[id].pixmap = NULL; |
7342 } | 7342 } |
7343 _PixmapArray[id].used = 0; | 7343 _DWPixmapArray[id].used = 0; |
7344 } | 7344 } |
7345 } | 7345 } |
7346 } | 7346 } |
7347 | 7347 |
7348 /* Clears a CList selection and associated selection list */ | 7348 /* Clears a CList selection and associated selection list */ |
7435 GdkPixmap *pixmap = NULL; | 7435 GdkPixmap *pixmap = NULL; |
7436 | 7436 |
7437 if(data) | 7437 if(data) |
7438 { | 7438 { |
7439 HICN hicon = *((HICN *)data); | 7439 HICN hicon = *((HICN *)data); |
7440 pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); | 7440 pixmap = _dw_find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
7441 } | 7441 } |
7442 gtk_clist_set_pixmap(GTK_CLIST(clist), row, column, pixmap ? pixmap : _dw_tmppixmap, pixmap ? bitmap : _dw_tmpbitmap); | 7442 gtk_clist_set_pixmap(GTK_CLIST(clist), row, column, pixmap ? pixmap : _dw_tmppixmap, pixmap ? bitmap : _dw_tmpbitmap); |
7443 } | 7443 } |
7444 else if(flag & DW_CFA_STRINGANDICON) | 7444 else if(flag & DW_CFA_STRINGANDICON) |
7445 { | 7445 { |
7447 GdkPixmap *pixmap = NULL; | 7447 GdkPixmap *pixmap = NULL; |
7448 | 7448 |
7449 if(data) | 7449 if(data) |
7450 { | 7450 { |
7451 HICN hicon = *((HICN *)data); | 7451 HICN hicon = *((HICN *)data); |
7452 pixmap = _find_pixmap(&bitmap, hicon, clist, NULL, NULL); | 7452 pixmap = _dw_find_pixmap(&bitmap, hicon, clist, NULL, NULL); |
7453 } | 7453 } |
7454 gtk_clist_set_pixtext(GTK_CLIST(clist), row, column, text ? text : textbuffer, 2, pixmap ? pixmap : _dw_tmppixmap, pixmap ? bitmap : _dw_tmpbitmap); | 7454 gtk_clist_set_pixtext(GTK_CLIST(clist), row, column, text ? text : textbuffer, 2, pixmap ? pixmap : _dw_tmppixmap, pixmap ? bitmap : _dw_tmpbitmap); |
7455 } | 7455 } |
7456 else if(flag & DW_CFA_STRING) | 7456 else if(flag & DW_CFA_STRING) |
7457 { | 7457 { |
8181 DW_MUTEX_UNLOCK; | 8181 DW_MUTEX_UNLOCK; |
8182 } | 8182 } |
8183 | 8183 |
8184 #if GTK_CHECK_VERSION(2,10,0) | 8184 #if GTK_CHECK_VERSION(2,10,0) |
8185 /* Translate the status message into a message on our buddy window */ | 8185 /* Translate the status message into a message on our buddy window */ |
8186 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) | 8186 static void _dw_status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) |
8187 { | 8187 { |
8188 GdkEventButton event = { 0 }; | 8188 GdkEventButton event = { 0 }; |
8189 long x, y; | 8189 long x, y; |
8190 gboolean retval; | 8190 gboolean retval; |
8191 | 8191 |
8212 GtkStatusIcon *status; | 8212 GtkStatusIcon *status; |
8213 GdkPixbuf *pixbuf; | 8213 GdkPixbuf *pixbuf; |
8214 int _locked_by_me = FALSE; | 8214 int _locked_by_me = FALSE; |
8215 | 8215 |
8216 DW_MUTEX_LOCK; | 8216 DW_MUTEX_LOCK; |
8217 pixbuf = _find_pixbuf(icon); | 8217 pixbuf = _dw_find_pixbuf(icon); |
8218 status = gtk_status_icon_new_from_pixbuf(pixbuf); | 8218 status = gtk_status_icon_new_from_pixbuf(pixbuf); |
8219 if(bubbletext) | 8219 if(bubbletext) |
8220 gtk_status_icon_set_tooltip_text(status, bubbletext); | 8220 gtk_status_icon_set_tooltip_text(status, bubbletext); |
8221 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); | 8221 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); |
8222 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); | 8222 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_dw_status_translate), handle); |
8223 gtk_status_icon_set_visible(status, TRUE); | 8223 gtk_status_icon_set_visible(status, TRUE); |
8224 DW_MUTEX_UNLOCK; | 8224 DW_MUTEX_UNLOCK; |
8225 #endif | 8225 #endif |
8226 } | 8226 } |
8227 | 8227 |
8288 gtk_widget_queue_draw(handle); | 8288 gtk_widget_queue_draw(handle); |
8289 DW_MUTEX_UNLOCK; | 8289 DW_MUTEX_UNLOCK; |
8290 } | 8290 } |
8291 | 8291 |
8292 /* Returns a GdkColor from a DW color */ | 8292 /* Returns a GdkColor from a DW color */ |
8293 static GdkColor _internal_color(unsigned long value) | 8293 static GdkColor _dw_internal_color(unsigned long value) |
8294 { | 8294 { |
8295 if(DW_RGB_COLOR & value) | 8295 if(DW_RGB_COLOR & value) |
8296 { | 8296 { |
8297 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; | 8297 GdkColor color = { 0, DW_RED_VALUE(value) << 8, DW_GREEN_VALUE(value) << 8, DW_BLUE_VALUE(value) << 8 }; |
8298 return color; | 8298 return color; |
8299 } | 8299 } |
8300 if (value < 16) | 8300 if (value < 16) |
8301 return _colors[value]; | 8301 return _dw_colors[value]; |
8302 return _colors[0]; | 8302 return _dw_colors[0]; |
8303 } | 8303 } |
8304 | 8304 |
8305 /* Sets the current foreground drawing color. | 8305 /* Sets the current foreground drawing color. |
8306 * Parameters: | 8306 * Parameters: |
8307 * red: red value. | 8307 * red: red value. |
8309 * blue: blue value. | 8309 * blue: blue value. |
8310 */ | 8310 */ |
8311 void dw_color_foreground_set(unsigned long value) | 8311 void dw_color_foreground_set(unsigned long value) |
8312 { | 8312 { |
8313 int _locked_by_me = FALSE; | 8313 int _locked_by_me = FALSE; |
8314 GdkColor color = _internal_color(value); | 8314 GdkColor color = _dw_internal_color(value); |
8315 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 8315 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
8316 | 8316 |
8317 DW_MUTEX_LOCK; | 8317 DW_MUTEX_LOCK; |
8318 gdk_color_alloc(_dw_cmap, &color); | 8318 gdk_color_alloc(_dw_cmap, &color); |
8319 *foreground = color; | 8319 *foreground = color; |
8339 free(background); | 8339 free(background); |
8340 } | 8340 } |
8341 } | 8341 } |
8342 else | 8342 else |
8343 { | 8343 { |
8344 GdkColor color = _internal_color(value); | 8344 GdkColor color = _dw_internal_color(value); |
8345 | 8345 |
8346 DW_MUTEX_LOCK; | 8346 DW_MUTEX_LOCK; |
8347 gdk_color_alloc(_dw_cmap, &color); | 8347 gdk_color_alloc(_dw_cmap, &color); |
8348 DW_MUTEX_UNLOCK; | 8348 DW_MUTEX_UNLOCK; |
8349 if(!background) | 8349 if(!background) |
8409 GtkWidget *colorw; | 8409 GtkWidget *colorw; |
8410 int _locked_by_me = FALSE; | 8410 int _locked_by_me = FALSE; |
8411 DWDialog *dwwait; | 8411 DWDialog *dwwait; |
8412 GtkColorSelection *colorsel; | 8412 GtkColorSelection *colorsel; |
8413 #if GTK_MAJOR_VERSION > 1 | 8413 #if GTK_MAJOR_VERSION > 1 |
8414 GdkColor color = _internal_color(value); | 8414 GdkColor color = _dw_internal_color(value); |
8415 #else | 8415 #else |
8416 gdouble colors[4]; | 8416 gdouble colors[4]; |
8417 #endif | 8417 #endif |
8418 unsigned long dw_color; | 8418 unsigned long dw_color; |
8419 | 8419 |
8460 dw_messagebox("Not implemented", DW_MB_OK|DW_MB_INFORMATION, "This feature not yet supported."); | 8460 dw_messagebox("Not implemented", DW_MB_OK|DW_MB_INFORMATION, "This feature not yet supported."); |
8461 return value; | 8461 return value; |
8462 */ | 8462 */ |
8463 } | 8463 } |
8464 | 8464 |
8465 GdkGC *_set_colors(GdkWindow *window) | 8465 GdkGC *_dw_set_colors(GdkWindow *window) |
8466 { | 8466 { |
8467 GdkGC *gc = NULL; | 8467 GdkGC *gc = NULL; |
8468 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 8468 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
8469 GdkColor *background = pthread_getspecific(_dw_bg_color_key); | 8469 GdkColor *background = pthread_getspecific(_dw_bg_color_key); |
8470 | 8470 |
8495 cairo_t *cr = NULL; | 8495 cairo_t *cr = NULL; |
8496 #endif | 8496 #endif |
8497 | 8497 |
8498 DW_MUTEX_LOCK; | 8498 DW_MUTEX_LOCK; |
8499 if(handle) | 8499 if(handle) |
8500 gc = _set_colors(handle->window); | 8500 gc = _dw_set_colors(handle->window); |
8501 else if(pixmap && pixmap->pixmap) | 8501 else if(pixmap && pixmap->pixmap) |
8502 gc = _set_colors(pixmap->pixmap); | 8502 gc = _dw_set_colors(pixmap->pixmap); |
8503 #if GTK_CHECK_VERSION(2,10,0) | 8503 #if GTK_CHECK_VERSION(2,10,0) |
8504 else if(pixmap && pixmap->image) | 8504 else if(pixmap && pixmap->image) |
8505 cr = cairo_create(pixmap->image); | 8505 cr = cairo_create(pixmap->image); |
8506 if(cr) | 8506 if(cr) |
8507 { | 8507 { |
8539 cairo_t *cr = NULL; | 8539 cairo_t *cr = NULL; |
8540 #endif | 8540 #endif |
8541 | 8541 |
8542 DW_MUTEX_LOCK; | 8542 DW_MUTEX_LOCK; |
8543 if(handle) | 8543 if(handle) |
8544 gc = _set_colors(handle->window); | 8544 gc = _dw_set_colors(handle->window); |
8545 else if(pixmap && pixmap->pixmap) | 8545 else if(pixmap && pixmap->pixmap) |
8546 gc = _set_colors(pixmap->pixmap); | 8546 gc = _dw_set_colors(pixmap->pixmap); |
8547 #if GTK_CHECK_VERSION(2,10,0) | 8547 #if GTK_CHECK_VERSION(2,10,0) |
8548 else if(pixmap && pixmap->image) | 8548 else if(pixmap && pixmap->image) |
8549 cr = cairo_create(pixmap->image); | 8549 cr = cairo_create(pixmap->image); |
8550 if(cr) | 8550 if(cr) |
8551 { | 8551 { |
8586 cairo_t *cr = NULL; | 8586 cairo_t *cr = NULL; |
8587 #endif | 8587 #endif |
8588 | 8588 |
8589 DW_MUTEX_LOCK; | 8589 DW_MUTEX_LOCK; |
8590 if(handle) | 8590 if(handle) |
8591 gc = _set_colors(handle->window); | 8591 gc = _dw_set_colors(handle->window); |
8592 else if(pixmap && pixmap->pixmap) | 8592 else if(pixmap && pixmap->pixmap) |
8593 gc = _set_colors(pixmap->pixmap); | 8593 gc = _dw_set_colors(pixmap->pixmap); |
8594 #if GTK_CHECK_VERSION(2,10,0) | 8594 #if GTK_CHECK_VERSION(2,10,0) |
8595 else if(pixmap && pixmap->image) | 8595 else if(pixmap && pixmap->image) |
8596 cr = cairo_create(pixmap->image); | 8596 cr = cairo_create(pixmap->image); |
8597 if(cr) | 8597 if(cr) |
8598 { | 8598 { |
8650 cairo_t *cr = NULL; | 8650 cairo_t *cr = NULL; |
8651 #endif | 8651 #endif |
8652 | 8652 |
8653 DW_MUTEX_LOCK; | 8653 DW_MUTEX_LOCK; |
8654 if(handle) | 8654 if(handle) |
8655 gc = _set_colors(handle->window); | 8655 gc = _dw_set_colors(handle->window); |
8656 else if(pixmap && pixmap->pixmap) | 8656 else if(pixmap && pixmap->pixmap) |
8657 gc = _set_colors(pixmap->pixmap); | 8657 gc = _dw_set_colors(pixmap->pixmap); |
8658 #if GTK_CHECK_VERSION(2,10,0) | 8658 #if GTK_CHECK_VERSION(2,10,0) |
8659 else if(pixmap && pixmap->image) | 8659 else if(pixmap && pixmap->image) |
8660 cr = cairo_create(pixmap->image); | 8660 cr = cairo_create(pixmap->image); |
8661 if(cr) | 8661 if(cr) |
8662 { | 8662 { |
8711 int width = (int)(r*2); | 8711 int width = (int)(r*2); |
8712 int height = width; | 8712 int height = width; |
8713 | 8713 |
8714 DW_MUTEX_LOCK; | 8714 DW_MUTEX_LOCK; |
8715 if(handle) | 8715 if(handle) |
8716 gc = _set_colors(handle->window); | 8716 gc = _dw_set_colors(handle->window); |
8717 else if(pixmap && pixmap->pixmap) | 8717 else if(pixmap && pixmap->pixmap) |
8718 gc = _set_colors(pixmap->pixmap); | 8718 gc = _dw_set_colors(pixmap->pixmap); |
8719 #if GTK_CHECK_VERSION(2,10,0) | 8719 #if GTK_CHECK_VERSION(2,10,0) |
8720 else if(pixmap && pixmap->image) | 8720 else if(pixmap && pixmap->image) |
8721 cr = cairo_create(pixmap->image); | 8721 cr = cairo_create(pixmap->image); |
8722 if(cr) | 8722 if(cr) |
8723 { | 8723 { |
8807 DW_MUTEX_LOCK; | 8807 DW_MUTEX_LOCK; |
8808 if(handle) | 8808 if(handle) |
8809 { | 8809 { |
8810 if((tmpname = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_fontname"))) | 8810 if((tmpname = (char *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_fontname"))) |
8811 fontname = tmpname; | 8811 fontname = tmpname; |
8812 gc = _set_colors(handle->window); | 8812 gc = _dw_set_colors(handle->window); |
8813 } | 8813 } |
8814 else if(pixmap && pixmap->pixmap) | 8814 else if(pixmap && pixmap->pixmap) |
8815 { | 8815 { |
8816 if(pixmap->font) | 8816 if(pixmap->font) |
8817 fontname = pixmap->font; | 8817 fontname = pixmap->font; |
8818 else if((tmpname = (char *)gtk_object_get_data(GTK_OBJECT(pixmap->handle), "_dw_fontname"))) | 8818 else if((tmpname = (char *)gtk_object_get_data(GTK_OBJECT(pixmap->handle), "_dw_fontname"))) |
8819 fontname = tmpname; | 8819 fontname = tmpname; |
8820 gc = _set_colors(pixmap->pixmap); | 8820 gc = _dw_set_colors(pixmap->pixmap); |
8821 } | 8821 } |
8822 #if GTK_CHECK_VERSION(2,10,0) | 8822 #if GTK_CHECK_VERSION(2,10,0) |
8823 else if(pixmap && pixmap->image) | 8823 else if(pixmap && pixmap->image) |
8824 { | 8824 { |
8825 if(pixmap->font) | 8825 if(pixmap->font) |
9101 { | 9101 { |
9102 /* Try with various extentions */ | 9102 /* Try with various extentions */ |
9103 for ( i = 0; i < NUM_EXTS; i++ ) | 9103 for ( i = 0; i < NUM_EXTS; i++ ) |
9104 { | 9104 { |
9105 strcpy( file, filename ); | 9105 strcpy( file, filename ); |
9106 strcat( file, image_exts[i] ); | 9106 strcat( file, _dw_image_exts[i] ); |
9107 if ( access( file, 04 ) == 0 ) | 9107 if ( access( file, 04 ) == 0 ) |
9108 { | 9108 { |
9109 found_ext = 1; | 9109 found_ext = 1; |
9110 break; | 9110 break; |
9111 } | 9111 } |
9131 | 9131 |
9132 gdk_imlib_render(image, pixmap->width, pixmap->height); | 9132 gdk_imlib_render(image, pixmap->width, pixmap->height); |
9133 pixmap->pixmap = gdk_imlib_copy_image(image); | 9133 pixmap->pixmap = gdk_imlib_copy_image(image); |
9134 gdk_imlib_destroy_image(image); | 9134 gdk_imlib_destroy_image(image); |
9135 #else | 9135 #else |
9136 pixmap->pixmap = gdk_pixmap_create_from_xpm(handle->window, &pixmap->bitmap, &_colors[DW_CLR_PALEGRAY], file); | 9136 pixmap->pixmap = gdk_pixmap_create_from_xpm(handle->window, &pixmap->bitmap, &_dw_colors[DW_CLR_PALEGRAY], file); |
9137 #endif | 9137 #endif |
9138 pixmap->handle = handle; | 9138 pixmap->handle = handle; |
9139 DW_MUTEX_UNLOCK; | 9139 DW_MUTEX_UNLOCK; |
9140 return pixmap; | 9140 return pixmap; |
9141 } | 9141 } |
9194 | 9194 |
9195 gdk_imlib_render(image, pixmap->width, pixmap->height); | 9195 gdk_imlib_render(image, pixmap->width, pixmap->height); |
9196 pixmap->pixmap = gdk_imlib_copy_image(image); | 9196 pixmap->pixmap = gdk_imlib_copy_image(image); |
9197 gdk_imlib_destroy_image(image); | 9197 gdk_imlib_destroy_image(image); |
9198 #else | 9198 #else |
9199 pixmap->pixmap = gdk_pixmap_create_from_xpm_d(handle->window, &pixmap->bitmap, &_colors[DW_CLR_PALEGRAY], data); | 9199 pixmap->pixmap = gdk_pixmap_create_from_xpm_d(handle->window, &pixmap->bitmap, &_dw_colors[DW_CLR_PALEGRAY], data); |
9200 #endif | 9200 #endif |
9201 /* remove our temporary file */ | 9201 /* remove our temporary file */ |
9202 unlink(template); | 9202 unlink(template); |
9203 pixmap->handle = handle; | 9203 pixmap->handle = handle; |
9204 DW_MUTEX_UNLOCK; | 9204 DW_MUTEX_UNLOCK; |
9234 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | 9234 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
9235 return NULL; | 9235 return NULL; |
9236 | 9236 |
9237 | 9237 |
9238 DW_MUTEX_LOCK; | 9238 DW_MUTEX_LOCK; |
9239 pixmap->pixmap = _find_pixmap(&pixmap->bitmap, (HICN)id, handle, &pixmap->width, &pixmap->height); | 9239 pixmap->pixmap = _dw_find_pixmap(&pixmap->bitmap, (HICN)id, handle, &pixmap->width, &pixmap->height); |
9240 if(pixmap->pixmap) | 9240 if(pixmap->pixmap) |
9241 { | 9241 { |
9242 #if GTK_MAJOR_VERSION < 2 | 9242 #if GTK_MAJOR_VERSION < 2 |
9243 GdkPixmapPrivate *pvt = (GdkPixmapPrivate *)pixmap->pixmap; | 9243 GdkPixmapPrivate *pvt = (GdkPixmapPrivate *)pixmap->pixmap; |
9244 pixmap->width = pvt->width; pixmap->height = pvt->height; | 9244 pixmap->width = pvt->width; pixmap->height = pvt->height; |
9277 { | 9277 { |
9278 if(pixmap && fontname && *fontname) | 9278 if(pixmap && fontname && *fontname) |
9279 { | 9279 { |
9280 char *oldfont = pixmap->font; | 9280 char *oldfont = pixmap->font; |
9281 pixmap->font = strdup(fontname); | 9281 pixmap->font = strdup(fontname); |
9282 _convert_font(pixmap->font); | 9282 _dw_convert_font(pixmap->font); |
9283 if(oldfont) | 9283 if(oldfont) |
9284 free(oldfont); | 9284 free(oldfont); |
9285 return DW_ERROR_NONE; | 9285 return DW_ERROR_NONE; |
9286 } | 9286 } |
9287 return DW_ERROR_GENERAL; | 9287 return DW_ERROR_GENERAL; |
9307 DW_MUTEX_UNLOCK; | 9307 DW_MUTEX_UNLOCK; |
9308 } | 9308 } |
9309 | 9309 |
9310 #if GTK_CHECK_VERSION(2,10,0) | 9310 #if GTK_CHECK_VERSION(2,10,0) |
9311 /* Cairo version of dw_pixmap_bitblt() from GTK3, use if either pixmap is a cairo surface */ | 9311 /* Cairo version of dw_pixmap_bitblt() from GTK3, use if either pixmap is a cairo surface */ |
9312 int _cairo_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) | 9312 int _dw_cairo_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) |
9313 { | 9313 { |
9314 int _locked_by_me = FALSE; | 9314 int _locked_by_me = FALSE; |
9315 cairo_t *cr = NULL; | 9315 cairo_t *cr = NULL; |
9316 int retval = DW_ERROR_GENERAL; | 9316 int retval = DW_ERROR_GENERAL; |
9317 | 9317 |
9424 GdkGC *gc = NULL; | 9424 GdkGC *gc = NULL; |
9425 int retval = DW_ERROR_GENERAL; | 9425 int retval = DW_ERROR_GENERAL; |
9426 | 9426 |
9427 #if GTK_CHECK_VERSION(2,10,0) | 9427 #if GTK_CHECK_VERSION(2,10,0) |
9428 if((destp && destp->image) || (srcp && srcp->image)) | 9428 if((destp && destp->image) || (srcp && srcp->image)) |
9429 return _cairo_pixmap_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, srcwidth, srcheight); | 9429 return _dw_cairo_pixmap_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, srcwidth, srcheight); |
9430 #endif | 9430 #endif |
9431 | 9431 |
9432 if((!dest && (!destp || !destp->pixmap)) || (!src && (!srcp || !srcp->pixmap))) | 9432 if((!dest && (!destp || !destp->pixmap)) || (!src && (!srcp || !srcp->pixmap))) |
9433 return retval; | 9433 return retval; |
9434 | 9434 |
9435 if((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight) | 9435 if((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight) |
9436 return retval; | 9436 return retval; |
9437 | 9437 |
9438 DW_MUTEX_LOCK; | 9438 DW_MUTEX_LOCK; |
9439 if(dest) | 9439 if(dest) |
9440 gc = _set_colors(dest->window); | 9440 gc = _dw_set_colors(dest->window); |
9441 else if(src) | 9441 else if(src) |
9442 gc = _set_colors(src->window); | 9442 gc = _dw_set_colors(src->window); |
9443 else if(destp) | 9443 else if(destp) |
9444 gc = gdk_gc_new(destp->pixmap); | 9444 gc = gdk_gc_new(destp->pixmap); |
9445 else if(srcp) | 9445 else if(srcp) |
9446 gc = gdk_gc_new(srcp->pixmap); | 9446 gc = gdk_gc_new(srcp->pixmap); |
9447 | 9447 |
9796 *eve = NULL; | 9796 *eve = NULL; |
9797 | 9797 |
9798 return DW_ERROR_NONE; | 9798 return DW_ERROR_NONE; |
9799 } | 9799 } |
9800 | 9800 |
9801 struct _seminfo { | 9801 struct _dw_seminfo { |
9802 int fd; | 9802 int fd; |
9803 int waiting; | 9803 int waiting; |
9804 }; | 9804 }; |
9805 | 9805 |
9806 static void _handle_sem(int *tmpsock) | 9806 static void _dw_handle_sem(int *tmpsock) |
9807 { | 9807 { |
9808 fd_set rd; | 9808 fd_set rd; |
9809 struct _seminfo *array = (struct _seminfo *)malloc(sizeof(struct _seminfo)); | 9809 struct _dw_seminfo *array = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)); |
9810 int listenfd = tmpsock[0]; | 9810 int listenfd = tmpsock[0]; |
9811 int bytesread, connectcount = 1, maxfd, z, posted = 0; | 9811 int bytesread, connectcount = 1, maxfd, z, posted = 0; |
9812 char command; | 9812 char command; |
9813 sigset_t mask; | 9813 sigset_t mask; |
9814 | 9814 |
9851 return; | 9851 return; |
9852 } | 9852 } |
9853 | 9853 |
9854 if(FD_ISSET(listenfd, &rd)) | 9854 if(FD_ISSET(listenfd, &rd)) |
9855 { | 9855 { |
9856 struct _seminfo *newarray; | 9856 struct _dw_seminfo *newarray; |
9857 int newfd = accept(listenfd, 0, 0); | 9857 int newfd = accept(listenfd, 0, 0); |
9858 | 9858 |
9859 if(newfd > -1) | 9859 if(newfd > -1) |
9860 { | 9860 { |
9861 /* Add new connections to the set */ | 9861 /* Add new connections to the set */ |
9862 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount+1)); | 9862 newarray = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)*(connectcount+1)); |
9863 memcpy(newarray, array, sizeof(struct _seminfo)*(connectcount)); | 9863 memcpy(newarray, array, sizeof(struct _dw_seminfo)*(connectcount)); |
9864 | 9864 |
9865 newarray[connectcount].fd = newfd; | 9865 newarray[connectcount].fd = newfd; |
9866 newarray[connectcount].waiting = 0; | 9866 newarray[connectcount].waiting = 0; |
9867 | 9867 |
9868 connectcount++; | 9868 connectcount++; |
9878 { | 9878 { |
9879 if(FD_ISSET(array[z].fd, &rd)) | 9879 if(FD_ISSET(array[z].fd, &rd)) |
9880 { | 9880 { |
9881 if((bytesread = read(array[z].fd, &command, 1)) < 1) | 9881 if((bytesread = read(array[z].fd, &command, 1)) < 1) |
9882 { | 9882 { |
9883 struct _seminfo *newarray; | 9883 struct _dw_seminfo *newarray; |
9884 | 9884 |
9885 /* Remove this connection from the set */ | 9885 /* Remove this connection from the set */ |
9886 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount-1)); | 9886 newarray = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)*(connectcount-1)); |
9887 if(!z) | 9887 if(!z) |
9888 memcpy(newarray, &array[1], sizeof(struct _seminfo)*(connectcount-1)); | 9888 memcpy(newarray, &array[1], sizeof(struct _dw_seminfo)*(connectcount-1)); |
9889 else | 9889 else |
9890 { | 9890 { |
9891 memcpy(newarray, array, sizeof(struct _seminfo)*z); | 9891 memcpy(newarray, array, sizeof(struct _dw_seminfo)*z); |
9892 if(z!=(connectcount-1)) | 9892 if(z!=(connectcount-1)) |
9893 memcpy(&newarray[z], &array[z+1], sizeof(struct _seminfo)*(z-connectcount-1)); | 9893 memcpy(&newarray[z], &array[z+1], sizeof(struct _dw_seminfo)*(z-connectcount-1)); |
9894 } | 9894 } |
9895 connectcount--; | 9895 connectcount--; |
9896 | 9896 |
9897 /* Replace old array with new one */ | 9897 /* Replace old array with new one */ |
9898 free(array); | 9898 free(array); |
10000 free(tmpsock); | 10000 free(tmpsock); |
10001 return NULL; | 10001 return NULL; |
10002 } | 10002 } |
10003 | 10003 |
10004 /* Create a thread to handle this event semaphore */ | 10004 /* Create a thread to handle this event semaphore */ |
10005 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock); | 10005 pthread_create(&dwthread, NULL, (void *)_dw_handle_sem, (void *)tmpsock); |
10006 return GINT_TO_POINTER(ev); | 10006 return GINT_TO_POINTER(ev); |
10007 } | 10007 } |
10008 | 10008 |
10009 /* Open an already existing named event semaphore. | 10009 /* Open an already existing named event semaphore. |
10010 * Parameters: | 10010 * Parameters: |
10128 * an open or create call. | 10128 * an open or create call. |
10129 */ | 10129 */ |
10130 int dw_named_event_close(HEV eve) | 10130 int dw_named_event_close(HEV eve) |
10131 { | 10131 { |
10132 /* Finally close the domain socket, | 10132 /* Finally close the domain socket, |
10133 * cleanup will continue in _handle_sem. | 10133 * cleanup will continue in _dw_handle_sem. |
10134 */ | 10134 */ |
10135 close(GPOINTER_TO_INT(eve)); | 10135 close(GPOINTER_TO_INT(eve)); |
10136 return DW_ERROR_NONE; | 10136 return DW_ERROR_NONE; |
10137 } | 10137 } |
10138 | 10138 |
10358 } | 10358 } |
10359 | 10359 |
10360 #define DW_EXPAND (GTK_EXPAND | GTK_SHRINK | GTK_FILL) | 10360 #define DW_EXPAND (GTK_EXPAND | GTK_SHRINK | GTK_FILL) |
10361 | 10361 |
10362 /* Internal function that changes the attachment properties in a table. */ | 10362 /* Internal function that changes the attachment properties in a table. */ |
10363 void _rearrange_table(GtkWidget *widget, gpointer data) | 10363 void _dw_rearrange_table(GtkWidget *widget, gpointer data) |
10364 { | 10364 { |
10365 gint pos = GPOINTER_TO_INT(data); | 10365 gint pos = GPOINTER_TO_INT(data); |
10366 GtkContainer *cont = gtk_object_get_data(GTK_OBJECT(widget), "_dw_table"); | 10366 GtkContainer *cont = gtk_object_get_data(GTK_OBJECT(widget), "_dw_table"); |
10367 guint oldpos; | 10367 guint oldpos; |
10368 | 10368 |
10391 } | 10391 } |
10392 } | 10392 } |
10393 } | 10393 } |
10394 | 10394 |
10395 /* Internal function to get the recommended size of scrolled items */ | 10395 /* Internal function to get the recommended size of scrolled items */ |
10396 void _get_scrolled_size(GtkWidget *item, gint *thiswidth, gint *thisheight) | 10396 void _dw_get_scrolled_size(GtkWidget *item, gint *thiswidth, gint *thisheight) |
10397 { | 10397 { |
10398 GtkWidget *widget = gtk_object_get_user_data(GTK_OBJECT(item)); | 10398 GtkWidget *widget = gtk_object_get_user_data(GTK_OBJECT(item)); |
10399 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | 10399 static char testtext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
10400 | 10400 |
10401 /* Try to figure out the contents for Listbox and Container */ | 10401 /* Try to figure out the contents for Listbox and Container */ |
10577 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); | 10577 gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); |
10578 } | 10578 } |
10579 | 10579 |
10580 gtk_object_set_data(GTK_OBJECT(item), "_dw_table", box); | 10580 gtk_object_set_data(GTK_OBJECT(item), "_dw_table", box); |
10581 if(index < boxcount) | 10581 if(index < boxcount) |
10582 gtk_container_forall(GTK_CONTAINER(box),_rearrange_table, GINT_TO_POINTER(boxtype == DW_VERT ? index : -(index+1))); | 10582 gtk_container_forall(GTK_CONTAINER(box),_dw_rearrange_table, GINT_TO_POINTER(boxtype == DW_VERT ? index : -(index+1))); |
10583 gtk_table_attach(GTK_TABLE(box), item, x, x + 1, y, y + 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); | 10583 gtk_table_attach(GTK_TABLE(box), item, x, x + 1, y, y + 1, hsize ? DW_EXPAND : 0, vsize ? DW_EXPAND : 0, pad, pad); |
10584 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); | 10584 gtk_object_set_data(GTK_OBJECT(box), "_dw_boxcount", GINT_TO_POINTER(boxcount + 1)); |
10585 { | 10585 { |
10586 int thiswidth = width, thisheight = height; | 10586 int thiswidth = width, thisheight = height; |
10587 | 10587 |
10590 */ | 10590 */ |
10591 if(GTK_IS_SCROLLED_WINDOW(item) && ((width < 1 && !hsize) || (height < 1 && !vsize))) | 10591 if(GTK_IS_SCROLLED_WINDOW(item) && ((width < 1 && !hsize) || (height < 1 && !vsize))) |
10592 { | 10592 { |
10593 gint scrolledwidth = 0, scrolledheight = 0; | 10593 gint scrolledwidth = 0, scrolledheight = 0; |
10594 | 10594 |
10595 _get_scrolled_size(item, &scrolledwidth, &scrolledheight); | 10595 _dw_get_scrolled_size(item, &scrolledwidth, &scrolledheight); |
10596 | 10596 |
10597 if(width < 1 && !hsize) | 10597 if(width < 1 && !hsize) |
10598 thiswidth = scrolledwidth; | 10598 thiswidth = scrolledwidth; |
10599 if(height < 1 && !vsize) | 10599 if(height < 1 && !vsize) |
10600 thisheight = scrolledheight; | 10600 thisheight = scrolledheight; |
10673 | 10673 |
10674 /* If we are destroying the last item in the box this isn't necessary */ | 10674 /* If we are destroying the last item in the box this isn't necessary */ |
10675 if((pos+1) < boxcount) | 10675 if((pos+1) < boxcount) |
10676 { | 10676 { |
10677 /* If we need to contract the table, reposition all the children */ | 10677 /* If we need to contract the table, reposition all the children */ |
10678 gtk_container_forall(GTK_CONTAINER(box),_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); | 10678 gtk_container_forall(GTK_CONTAINER(box),_dw_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); |
10679 } | 10679 } |
10680 | 10680 |
10681 if(boxcount > 0) | 10681 if(boxcount > 0) |
10682 { | 10682 { |
10683 /* Decrease the count by 1 */ | 10683 /* Decrease the count by 1 */ |
10759 | 10759 |
10760 /* If we are destroying the last item in the box this isn't necessary */ | 10760 /* If we are destroying the last item in the box this isn't necessary */ |
10761 if((pos+1) < boxcount) | 10761 if((pos+1) < boxcount) |
10762 { | 10762 { |
10763 /* If we need to contract the table, reposition all the children */ | 10763 /* If we need to contract the table, reposition all the children */ |
10764 gtk_container_forall(GTK_CONTAINER(box),_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); | 10764 gtk_container_forall(GTK_CONTAINER(box),_dw_rearrange_table_destroy, GINT_TO_POINTER(boxtype == DW_VERT ? pos : -(pos+1))); |
10765 } | 10765 } |
10766 | 10766 |
10767 if(boxcount > 0) | 10767 if(boxcount > 0) |
10768 { | 10768 { |
10769 /* Decrease the count by 1 */ | 10769 /* Decrease the count by 1 */ |
10833 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | 10833 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
10834 { | 10834 { |
10835 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); | 10835 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
10836 } | 10836 } |
10837 | 10837 |
10838 union extents_union { guchar **gu_extents; unsigned long **extents; }; | 10838 union _dw_extents_union { guchar **gu_extents; unsigned long **extents; }; |
10839 static GdkAtom extents_atom = 0; | 10839 static GdkAtom _dw_extents_atom = 0; |
10840 static time_t extents_time = 0; | 10840 static time_t _dw_extents_time = 0; |
10841 | 10841 |
10842 static gboolean _dw_property_notify(GtkWidget *window, GdkEventProperty* event, GdkWindow *gdkwindow) | 10842 static gboolean _dw_property_notify(GtkWidget *window, GdkEventProperty* event, GdkWindow *gdkwindow) |
10843 { | 10843 { |
10844 /* Check to see if we got a property change */ | 10844 /* Check to see if we got a property change */ |
10845 if(event->state == GDK_PROPERTY_NEW_VALUE && event->atom == extents_atom && event->window == gdkwindow) | 10845 if(event->state == GDK_PROPERTY_NEW_VALUE && event->atom == _dw_extents_atom && event->window == gdkwindow) |
10846 extents_time = 0; | 10846 _dw_extents_time = 0; |
10847 return FALSE; | 10847 return FALSE; |
10848 } | 10848 } |
10849 | 10849 |
10850 /* Internal function to figure out the frame extents of an unmapped window */ | 10850 /* Internal function to figure out the frame extents of an unmapped window */ |
10851 void _dw_get_frame_extents(GtkWidget *window, int *vert, int *horz) | 10851 void _dw_get_frame_extents(GtkWidget *window, int *vert, int *horz) |
10852 { | 10852 { |
10853 if(gtk_window_get_decorated(GTK_WINDOW(window))) | 10853 if(gtk_window_get_decorated(GTK_WINDOW(window))) |
10854 { | 10854 { |
10855 const char *request = "_NET_REQUEST_FRAME_EXTENTS"; | 10855 const char *request = "_NET_REQUEST_FRAME_EXTENTS"; |
10856 unsigned long *extents = NULL; | 10856 unsigned long *extents = NULL; |
10857 union extents_union eu; | 10857 union _dw_extents_union eu; |
10858 GdkAtom request_extents = gdk_atom_intern(request, FALSE); | 10858 GdkAtom request_extents = gdk_atom_intern(request, FALSE); |
10859 | 10859 |
10860 if(!extents_atom) | 10860 if(!_dw_extents_atom) |
10861 extents_atom = gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE); | 10861 _dw_extents_atom = gdk_atom_intern("_NET_FRAME_EXTENTS", FALSE); |
10862 | 10862 |
10863 /* Set some rational defaults.. just in case */ | 10863 /* Set some rational defaults.. just in case */ |
10864 *vert = 28; | 10864 *vert = 28; |
10865 *horz = 12; | 10865 *horz = 12; |
10866 | 10866 |
10890 | 10890 |
10891 /* Connect a signal to look for the property change */ | 10891 /* Connect a signal to look for the property change */ |
10892 connid = gtk_signal_connect(GTK_OBJECT(window), "property_notify_event", GTK_SIGNAL_FUNC(_dw_property_notify), window->window); | 10892 connid = gtk_signal_connect(GTK_OBJECT(window), "property_notify_event", GTK_SIGNAL_FUNC(_dw_property_notify), window->window); |
10893 | 10893 |
10894 /* Record the request time */ | 10894 /* Record the request time */ |
10895 time(&extents_time); | 10895 time(&_dw_extents_time); |
10896 | 10896 |
10897 /* Look for the property notify event */ | 10897 /* Look for the property notify event */ |
10898 do | 10898 do |
10899 { | 10899 { |
10900 dw_main_iteration(); | 10900 dw_main_iteration(); |
10901 time(&currtime); | 10901 time(&currtime); |
10902 } | 10902 } |
10903 while(currtime - extents_time < 2); | 10903 while(currtime - _dw_extents_time < 2); |
10904 | 10904 |
10905 /* Remove the signal handler now that we are done */ | 10905 /* Remove the signal handler now that we are done */ |
10906 gtk_signal_disconnect(GTK_OBJECT(window), connid); | 10906 gtk_signal_disconnect(GTK_OBJECT(window), connid); |
10907 } | 10907 } |
10908 | 10908 |
10909 /* Attempt to retrieve window's frame extents. */ | 10909 /* Attempt to retrieve window's frame extents. */ |
10910 eu.extents = &extents; | 10910 eu.extents = &extents; |
10911 if(gdk_property_get(window->window, | 10911 if(gdk_property_get(window->window, |
10912 extents_atom, | 10912 _dw_extents_atom, |
10913 gdk_atom_intern("CARDINAL", FALSE), | 10913 gdk_atom_intern("CARDINAL", FALSE), |
10914 0, sizeof(unsigned long)*4, FALSE, | 10914 0, sizeof(unsigned long)*4, FALSE, |
10915 NULL, NULL, NULL, eu.gu_extents)) | 10915 NULL, NULL, NULL, eu.gu_extents)) |
10916 { | 10916 { |
10917 *horz = extents[0] + extents[1]; | 10917 *horz = extents[0] + extents[1]; |
10940 if(GTK_IS_WINDOW(handle)) | 10940 if(GTK_IS_WINDOW(handle)) |
10941 { | 10941 { |
10942 int cx = 0, cy = 0; | 10942 int cx = 0, cy = 0; |
10943 | 10943 |
10944 #ifdef GDK_WINDOWING_X11 | 10944 #ifdef GDK_WINDOWING_X11 |
10945 _size_allocate(GTK_WINDOW(handle)); | 10945 _dw_size_allocate(GTK_WINDOW(handle)); |
10946 #endif | 10946 #endif |
10947 /* If the window is mapped */ | 10947 /* If the window is mapped */ |
10948 if(handle->window && GTK_WIDGET_MAPPED(handle)) | 10948 if(handle->window && GTK_WIDGET_MAPPED(handle)) |
10949 { | 10949 { |
10950 #if GTK_MAJOR_VERSION > 1 | 10950 #if GTK_MAJOR_VERSION > 1 |
11008 DW_MUTEX_LOCK; | 11008 DW_MUTEX_LOCK; |
11009 if(GTK_IS_SCROLLED_WINDOW(handle)) | 11009 if(GTK_IS_SCROLLED_WINDOW(handle)) |
11010 { | 11010 { |
11011 gint scrolledwidth, scrolledheight; | 11011 gint scrolledwidth, scrolledheight; |
11012 | 11012 |
11013 _get_scrolled_size(handle, &scrolledwidth, &scrolledheight); | 11013 _dw_get_scrolled_size(handle, &scrolledwidth, &scrolledheight); |
11014 | 11014 |
11015 if(width) | 11015 if(width) |
11016 *width = scrolledwidth; | 11016 *width = scrolledwidth; |
11017 if(height) | 11017 if(height) |
11018 *height = scrolledheight; | 11018 *height = scrolledheight; |
11415 /* Hopefully this won't happen. */ | 11415 /* Hopefully this won't happen. */ |
11416 return 256; | 11416 return 256; |
11417 } | 11417 } |
11418 | 11418 |
11419 /* Return the physical page id from the logical page id */ | 11419 /* Return the physical page id from the logical page id */ |
11420 int _get_physical_page(HWND handle, unsigned long pageid) | 11420 int _dw_get_physical_page(HWND handle, unsigned long pageid) |
11421 { | 11421 { |
11422 int z; | 11422 int z; |
11423 GtkWidget *thispage, **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); | 11423 GtkWidget *thispage, **pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"); |
11424 | 11424 |
11425 if(pagearray) | 11425 if(pagearray) |
11446 { | 11446 { |
11447 int realpage, _locked_by_me = FALSE; | 11447 int realpage, _locked_by_me = FALSE; |
11448 GtkWidget **pagearray; | 11448 GtkWidget **pagearray; |
11449 | 11449 |
11450 DW_MUTEX_LOCK; | 11450 DW_MUTEX_LOCK; |
11451 realpage = _get_physical_page(handle, pageid); | 11451 realpage = _dw_get_physical_page(handle, pageid); |
11452 if(realpage > -1 && realpage < 256) | 11452 if(realpage > -1 && realpage < 256) |
11453 { | 11453 { |
11454 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), realpage); | 11454 gtk_notebook_remove_page(GTK_NOTEBOOK(handle), realpage); |
11455 if((pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"))) | 11455 if((pagearray = gtk_object_get_data(GTK_OBJECT(handle), "_dw_pagearray"))) |
11456 pagearray[pageid] = NULL; | 11456 pagearray[pageid] = NULL; |
11468 int retval, phys; | 11468 int retval, phys; |
11469 int _locked_by_me = FALSE; | 11469 int _locked_by_me = FALSE; |
11470 | 11470 |
11471 DW_MUTEX_LOCK; | 11471 DW_MUTEX_LOCK; |
11472 phys = gtk_notebook_get_current_page(GTK_NOTEBOOK(handle)); | 11472 phys = gtk_notebook_get_current_page(GTK_NOTEBOOK(handle)); |
11473 retval = _get_logical_page(handle, phys); | 11473 retval = _dw_get_logical_page(handle, phys); |
11474 DW_MUTEX_UNLOCK; | 11474 DW_MUTEX_UNLOCK; |
11475 return retval; | 11475 return retval; |
11476 } | 11476 } |
11477 | 11477 |
11478 /* | 11478 /* |
11484 void dw_notebook_page_set(HWND handle, unsigned int pageid) | 11484 void dw_notebook_page_set(HWND handle, unsigned int pageid) |
11485 { | 11485 { |
11486 int realpage, _locked_by_me = FALSE; | 11486 int realpage, _locked_by_me = FALSE; |
11487 | 11487 |
11488 DW_MUTEX_LOCK; | 11488 DW_MUTEX_LOCK; |
11489 realpage = _get_physical_page(handle, pageid); | 11489 realpage = _dw_get_physical_page(handle, pageid); |
11490 if(realpage > -1 && realpage < 256) | 11490 if(realpage > -1 && realpage < 256) |
11491 gtk_notebook_set_page(GTK_NOTEBOOK(handle), pageid); | 11491 gtk_notebook_set_page(GTK_NOTEBOOK(handle), pageid); |
11492 DW_MUTEX_UNLOCK; | 11492 DW_MUTEX_UNLOCK; |
11493 } | 11493 } |
11494 | 11494 |
11504 { | 11504 { |
11505 GtkWidget *child; | 11505 GtkWidget *child; |
11506 int realpage, _locked_by_me = FALSE; | 11506 int realpage, _locked_by_me = FALSE; |
11507 | 11507 |
11508 DW_MUTEX_LOCK; | 11508 DW_MUTEX_LOCK; |
11509 realpage = _get_physical_page(handle, pageid); | 11509 realpage = _dw_get_physical_page(handle, pageid); |
11510 if(realpage < 0 || realpage > 255) | 11510 if(realpage < 0 || realpage > 255) |
11511 { | 11511 { |
11512 char ptext[101] = {0}; | 11512 char ptext[101] = {0}; |
11513 int num; | 11513 int num; |
11514 | 11514 |
11629 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); | 11629 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); |
11630 | 11630 |
11631 list_item=gtk_list_item_new_with_label(text); | 11631 list_item=gtk_list_item_new_with_label(text); |
11632 | 11632 |
11633 if(font) | 11633 if(font) |
11634 _set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); | 11634 _dw_set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); |
11635 if(fore && back) | 11635 if(fore && back) |
11636 _set_color(GTK_LIST_ITEM(list_item)->item.bin.child, | 11636 _dw_set_color(GTK_LIST_ITEM(list_item)->item.bin.child, |
11637 DW_RGB(fore->red, fore->green, fore->blue), | 11637 DW_RGB(fore->red, fore->green, fore->blue), |
11638 DW_RGB(back->red, back->green, back->blue)); | 11638 DW_RGB(back->red, back->green, back->blue)); |
11639 | 11639 |
11640 tmp = g_list_append(NULL, list_item); | 11640 tmp = g_list_append(NULL, list_item); |
11641 gtk_widget_show(list_item); | 11641 gtk_widget_show(list_item); |
11690 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); | 11690 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); |
11691 | 11691 |
11692 list_item=gtk_list_item_new_with_label(text); | 11692 list_item=gtk_list_item_new_with_label(text); |
11693 | 11693 |
11694 if(font) | 11694 if(font) |
11695 _set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); | 11695 _dw_set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); |
11696 if(fore && back) | 11696 if(fore && back) |
11697 _set_color(GTK_LIST_ITEM(list_item)->item.bin.child, | 11697 _dw_set_color(GTK_LIST_ITEM(list_item)->item.bin.child, |
11698 DW_RGB(fore->red, fore->green, fore->blue), | 11698 DW_RGB(fore->red, fore->green, fore->blue), |
11699 DW_RGB(back->red, back->green, back->blue)); | 11699 DW_RGB(back->red, back->green, back->blue)); |
11700 | 11700 |
11701 tmp = g_list_insert(NULL, list_item, pos); | 11701 tmp = g_list_insert(NULL, list_item, pos); |
11702 gtk_widget_show(list_item); | 11702 gtk_widget_show(list_item); |
11750 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); | 11750 GdkColor *back = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle2), "_dw_backgdk"); |
11751 | 11751 |
11752 list_item=gtk_list_item_new_with_label(*text); | 11752 list_item=gtk_list_item_new_with_label(*text); |
11753 | 11753 |
11754 if(font) | 11754 if(font) |
11755 _set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); | 11755 _dw_set_font(GTK_LIST_ITEM(list_item)->item.bin.child, font); |
11756 if(fore && back) | 11756 if(fore && back) |
11757 _set_color(GTK_LIST_ITEM(list_item)->item.bin.child, | 11757 _dw_set_color(GTK_LIST_ITEM(list_item)->item.bin.child, |
11758 DW_RGB(fore->red, fore->green, fore->blue), | 11758 DW_RGB(fore->red, fore->green, fore->blue), |
11759 DW_RGB(back->red, back->green, back->blue)); | 11759 DW_RGB(back->red, back->green, back->blue)); |
11760 | 11760 |
11761 tmp = g_list_append(NULL, list_item); | 11761 tmp = g_list_append(NULL, list_item); |
11762 gtk_widget_show(list_item); | 11762 gtk_widget_show(list_item); |
12228 } | 12228 } |
12229 DW_MUTEX_UNLOCK; | 12229 DW_MUTEX_UNLOCK; |
12230 } | 12230 } |
12231 | 12231 |
12232 /* Reposition the bar according to the percentage */ | 12232 /* Reposition the bar according to the percentage */ |
12233 static gint _splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data) | 12233 static gint _dw_splitbar_size_allocate(GtkWidget *widget, GtkAllocation *event, gpointer data) |
12234 { | 12234 { |
12235 float *percent = (float *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_percent"); | 12235 float *percent = (float *)gtk_object_get_data(GTK_OBJECT(widget), "_dw_percent"); |
12236 | 12236 |
12237 /* Prevent infinite recursion ;) */ | 12237 /* Prevent infinite recursion ;) */ |
12238 if(!percent || event->width < 20 || event->height < 20) | 12238 if(!percent || event->width < 20 || event->height < 20) |
12270 gtk_paned_pack1(GTK_PANED(tmp), topleft, TRUE, TRUE); | 12270 gtk_paned_pack1(GTK_PANED(tmp), topleft, TRUE, TRUE); |
12271 gtk_paned_pack2(GTK_PANED(tmp), bottomright, TRUE, TRUE); | 12271 gtk_paned_pack2(GTK_PANED(tmp), bottomright, TRUE, TRUE); |
12272 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); | 12272 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); |
12273 *percent = 50.0; | 12273 *percent = 50.0; |
12274 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_percent", (gpointer)percent); | 12274 gtk_object_set_data(GTK_OBJECT(tmp), "_dw_percent", (gpointer)percent); |
12275 gtk_signal_connect(GTK_OBJECT(tmp), "size-allocate", GTK_SIGNAL_FUNC(_splitbar_size_allocate), NULL); | 12275 gtk_signal_connect(GTK_OBJECT(tmp), "size-allocate", GTK_SIGNAL_FUNC(_dw_splitbar_size_allocate), NULL); |
12276 #if GTK_MAJOR_VERSION < 2 | 12276 #if GTK_MAJOR_VERSION < 2 |
12277 gtk_paned_set_handle_size(GTK_PANED(tmp), 3); | 12277 gtk_paned_set_handle_size(GTK_PANED(tmp), 3); |
12278 #endif | 12278 #endif |
12279 gtk_widget_show(tmp); | 12279 gtk_widget_show(tmp); |
12280 DW_MUTEX_UNLOCK; | 12280 DW_MUTEX_UNLOCK; |
12442 | 12442 |
12443 if(!window) | 12443 if(!window) |
12444 return; | 12444 return; |
12445 | 12445 |
12446 DW_MUTEX_LOCK; | 12446 DW_MUTEX_LOCK; |
12447 gtk_signal_connect(GTK_OBJECT(window), "key_press_event", GTK_SIGNAL_FUNC(_default_key_press_event), next); | 12447 gtk_signal_connect(GTK_OBJECT(window), "key_press_event", GTK_SIGNAL_FUNC(_dw_default_key_press_event), next); |
12448 DW_MUTEX_UNLOCK; | 12448 DW_MUTEX_UNLOCK; |
12449 } | 12449 } |
12450 | 12450 |
12451 /* | 12451 /* |
12452 * Creates a new system notification if possible. | 12452 * Creates a new system notification if possible. |
12598 dw_dialog_dismiss(dwwait, NULL); | 12598 dw_dialog_dismiss(dwwait, NULL); |
12599 return FALSE; | 12599 return FALSE; |
12600 } | 12600 } |
12601 | 12601 |
12602 /* The next few functions are support functions for the UNIX folder browser */ | 12602 /* The next few functions are support functions for the UNIX folder browser */ |
12603 static void _populate_directory(HWND tree, HTREEITEM parent, char *path) | 12603 static void _dw_populate_directory(HWND tree, HTREEITEM parent, char *path) |
12604 { | 12604 { |
12605 struct dirent *dent; | 12605 struct dirent *dent; |
12606 HTREEITEM item; | 12606 HTREEITEM item; |
12607 DIR *hdir; | 12607 DIR *hdir; |
12608 | 12608 |
12660 dw_window_destroy((HWND)dwwait->data); | 12660 dw_window_destroy((HWND)dwwait->data); |
12661 dw_dialog_dismiss(dwwait, NULL); | 12661 dw_dialog_dismiss(dwwait, NULL); |
12662 return FALSE; | 12662 return FALSE; |
12663 } | 12663 } |
12664 | 12664 |
12665 static char *_tree_folder(HWND tree, HTREEITEM item) | 12665 static char *_dw_tree_folder(HWND tree, HTREEITEM item) |
12666 { | 12666 { |
12667 char *folder=strdup(""); | 12667 char *folder=strdup(""); |
12668 HTREEITEM parent = item; | 12668 HTREEITEM parent = item; |
12669 | 12669 |
12670 while(parent) | 12670 while(parent) |
12684 parent = dw_tree_get_parent(tree, parent); | 12684 parent = dw_tree_get_parent(tree, parent); |
12685 } | 12685 } |
12686 return folder; | 12686 return folder; |
12687 } | 12687 } |
12688 | 12688 |
12689 static int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) | 12689 static int DWSIGNAL _dw_item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) |
12690 { | 12690 { |
12691 DWDialog *dwwait = (DWDialog *)data; | 12691 DWDialog *dwwait = (DWDialog *)data; |
12692 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); | 12692 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
12693 | 12693 |
12694 text = text; itemdata = itemdata; | 12694 text = text; itemdata = itemdata; |
12695 if(treedata) | 12695 if(treedata) |
12696 free(treedata); | 12696 free(treedata); |
12697 | 12697 |
12698 treedata = _tree_folder(window, item); | 12698 treedata = _dw_tree_folder(window, item); |
12699 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); | 12699 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); |
12700 | 12700 |
12701 return FALSE; | 12701 return FALSE; |
12702 } | 12702 } |
12703 | 12703 |
12704 static int DWSIGNAL _tree_expand(HWND window, HTREEITEM item, void *data) | 12704 static int DWSIGNAL _dw_tree_expand(HWND window, HTREEITEM item, void *data) |
12705 { | 12705 { |
12706 DWDialog *dwwait = (DWDialog *)data; | 12706 DWDialog *dwwait = (DWDialog *)data; |
12707 HWND tree = (HWND)dw_window_get_data((HWND)dwwait->data, "_dw_tree"); | 12707 HWND tree = (HWND)dw_window_get_data((HWND)dwwait->data, "_dw_tree"); |
12708 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(tree, item); | 12708 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(tree, item); |
12709 | 12709 |
12710 if(tempitem) | 12710 if(tempitem) |
12711 { | 12711 { |
12712 char *folder = _tree_folder(tree, item); | 12712 char *folder = _dw_tree_folder(tree, item); |
12713 | 12713 |
12714 dw_tree_item_set_data(tree, item, 0); | 12714 dw_tree_item_set_data(tree, item, 0); |
12715 | 12715 |
12716 if(*folder) | 12716 if(*folder) |
12717 _populate_directory(tree, item, folder); | 12717 _dw_populate_directory(tree, item, folder); |
12718 | 12718 |
12719 #if GTK_MAJOR_VERSION > 1 | 12719 #if GTK_MAJOR_VERSION > 1 |
12720 /* FIXME: GTK 1.x tree control goes crazy when | 12720 /* FIXME: GTK 1.x tree control goes crazy when |
12721 * I delete the temporary item. The subtree | 12721 * I delete the temporary item. The subtree |
12722 * it sits on ceases to be valid and attempts | 12722 * it sits on ceases to be valid and attempts |
12890 | 12890 |
12891 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); | 12891 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); |
12892 | 12892 |
12893 dwwait = dw_dialog_new((void *)window); | 12893 dwwait = dw_dialog_new((void *)window); |
12894 | 12894 |
12895 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait); | 12895 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_dw_item_select), (void *)dwwait); |
12896 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); | 12896 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_dw_tree_expand), (void *)dwwait); |
12897 | 12897 |
12898 button = dw_button_new("Ok", 1001L); | 12898 button = dw_button_new("Ok", 1001L); |
12899 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); | 12899 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
12900 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_folder_ok_func), (void *)dwwait); | 12900 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_folder_ok_func), (void *)dwwait); |
12901 | 12901 |
13570 } | 13570 } |
13571 | 13571 |
13572 /* Get the actual signal window handle not the user window handle | 13572 /* Get the actual signal window handle not the user window handle |
13573 * Should mimic the code in dw_signal_connect() below. | 13573 * Should mimic the code in dw_signal_connect() below. |
13574 */ | 13574 */ |
13575 static HWND _find_signal_window(HWND window, const char *signame) | 13575 static HWND _dw_find_signal_window(HWND window, const char *signame) |
13576 { | 13576 { |
13577 HWND thiswindow = window; | 13577 HWND thiswindow = window; |
13578 | 13578 |
13579 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) | 13579 if(GTK_IS_SCROLLED_WINDOW(thiswindow)) |
13580 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); | 13580 thiswindow = (HWND)gtk_object_get_user_data(GTK_OBJECT(window)); |
13603 void **params = (void **)data; | 13603 void **params = (void **)data; |
13604 void (*discfunc)(HWND, void *) = params[1]; | 13604 void (*discfunc)(HWND, void *) = params[1]; |
13605 | 13605 |
13606 if(discfunc) | 13606 if(discfunc) |
13607 { | 13607 { |
13608 SignalHandler work = _get_signal_handler(data); | 13608 DWSignalHandler work = _dw_get_signal_handler(data); |
13609 | 13609 |
13610 if(work.window) | 13610 if(work.window) |
13611 { | 13611 { |
13612 discfunc(work.window, work.data); | 13612 discfunc(work.window, work.data); |
13613 } | 13613 } |
13640 * discfunc: The pointer to the function called when this handler is removed. | 13640 * discfunc: The pointer to the function called when this handler is removed. |
13641 * data: User data to be passed to the handler function. | 13641 * data: User data to be passed to the handler function. |
13642 */ | 13642 */ |
13643 void dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) | 13643 void dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
13644 { | 13644 { |
13645 void *thisfunc = _findsigfunc(signame); | 13645 void *thisfunc = _dw_findsigfunc(signame); |
13646 char *thisname = (char *)signame; | 13646 char *thisname = (char *)signame; |
13647 HWND thiswindow = window; | 13647 HWND thiswindow = window; |
13648 int sigid, _locked_by_me = FALSE; | 13648 int sigid, _locked_by_me = FALSE; |
13649 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); | 13649 void **params = calloc(_DW_INTERNAL_CALLBACK_PARAMS, sizeof(void *)); |
13650 gint cid; | 13650 gint cid; |
13680 } | 13680 } |
13681 | 13681 |
13682 if (GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) | 13682 if (GTK_IS_MENU_ITEM(thiswindow) && strcmp(signame, DW_SIGNAL_CLICKED) == 0) |
13683 { | 13683 { |
13684 thisname = "activate"; | 13684 thisname = "activate"; |
13685 thisfunc = _findsigfunc(thisname); | 13685 thisfunc = _dw_findsigfunc(thisname); |
13686 } | 13686 } |
13687 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) | 13687 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
13688 { | 13688 { |
13689 thisname = "button_press_event"; | 13689 thisname = "button_press_event"; |
13690 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_CONTEXT); | 13690 thisfunc = _dw_findsigfunc(DW_SIGNAL_ITEM_CONTEXT); |
13691 } | 13691 } |
13692 #if GTK_MAJOR_VERSION > 1 | 13692 #if GTK_MAJOR_VERSION > 1 |
13693 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) | 13693 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
13694 { | 13694 { |
13695 thisfunc = _findsigfunc("tree-context"); | 13695 thisfunc = _dw_findsigfunc("tree-context"); |
13696 | 13696 |
13697 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13697 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13698 params[0] = GINT_TO_POINTER(sigid); | 13698 params[0] = GINT_TO_POINTER(sigid); |
13699 params[2] = (void *)thiswindow; | 13699 params[2] = (void *)thiswindow; |
13700 cid = g_signal_connect_data(G_OBJECT(thiswindow), "button_press_event", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 13700 cid = g_signal_connect_data(G_OBJECT(thiswindow), "button_press_event", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
13701 _set_signal_handler_id(thiswindow, sigid, cid); | 13701 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13702 | 13702 |
13703 #if 0 | 13703 #if 0 |
13704 sigid = _set_signal_handler(window, window, sigfunc, data, thisfunc); | 13704 sigid = _dw_set_signal_handler(window, window, sigfunc, data, thisfunc); |
13705 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); | 13705 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), (gpointer)sigid); |
13706 _set_signal_handler_id(window, sigid, cid); | 13706 _dw_set_signal_handler_id(window, sigid, cid); |
13707 #endif | 13707 #endif |
13708 | 13708 |
13709 DW_MUTEX_UNLOCK; | 13709 DW_MUTEX_UNLOCK; |
13710 return; | 13710 return; |
13711 } | 13711 } |
13714 GtkWidget *treeview = thiswindow; | 13714 GtkWidget *treeview = thiswindow; |
13715 | 13715 |
13716 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); | 13716 thiswindow = (GtkWidget *)gtk_tree_view_get_selection(GTK_TREE_VIEW(thiswindow)); |
13717 thisname = "changed"; | 13717 thisname = "changed"; |
13718 | 13718 |
13719 sigid = _set_signal_handler(treeview, window, sigfunc, data, thisfunc); | 13719 sigid = _dw_set_signal_handler(treeview, window, sigfunc, data, thisfunc); |
13720 params[0] = GINT_TO_POINTER(sigid); | 13720 params[0] = GINT_TO_POINTER(sigid); |
13721 params[2] = (void *)treeview; | 13721 params[2] = (void *)treeview; |
13722 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, (GCallback)thisfunc, params, _dw_signal_disconnect, 0); | 13722 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, (GCallback)thisfunc, params, _dw_signal_disconnect, 0); |
13723 _set_signal_handler_id(treeview, sigid, cid); | 13723 _dw_set_signal_handler_id(treeview, sigid, cid); |
13724 DW_MUTEX_UNLOCK; | 13724 DW_MUTEX_UNLOCK; |
13725 return; | 13725 return; |
13726 } | 13726 } |
13727 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) | 13727 else if (GTK_IS_TREE_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
13728 { | 13728 { |
13729 thisname = "row-expanded"; | 13729 thisname = "row-expanded"; |
13730 } | 13730 } |
13731 #else | 13731 #else |
13732 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) | 13732 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_CONTEXT) == 0) |
13733 { | 13733 { |
13734 thisfunc = _findsigfunc("tree-context"); | 13734 thisfunc = _dw_findsigfunc("tree-context"); |
13735 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13735 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13736 params[0] = GINT_TO_POINTER(sigid); | 13736 params[0] = GINT_TO_POINTER(sigid); |
13737 params[2] = (void *)thiswindow; | 13737 params[2] = (void *)thiswindow; |
13738 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_func", (gpointer)thisfunc); | 13738 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_func", (gpointer)thisfunc); |
13739 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_data", params); | 13739 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_container_context_data", params); |
13740 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), params); | 13740 cid = gtk_signal_connect(GTK_OBJECT(thiswindow), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), params); |
13741 _set_signal_handler_id(thiswindow, sigid, cid); | 13741 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13742 | 13742 |
13743 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); | 13743 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); |
13744 sigid = _set_signal_handler(window, window, sigfunc, data, thisfunc); | 13744 sigid = _dw_set_signal_handler(window, window, sigfunc, data, thisfunc); |
13745 params[0] = GINT_TO_POINTER(sigid); | 13745 params[0] = GINT_TO_POINTER(sigid); |
13746 params[2] = (void *)thiswindow; | 13746 params[2] = (void *)thiswindow; |
13747 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), params); | 13747 cid = gtk_signal_connect(GTK_OBJECT(window), "button_press_event", GTK_SIGNAL_FUNC(thisfunc), params); |
13748 _set_signal_handler_id(window, sigid, cid); | 13748 _dw_set_signal_handler_id(window, sigid, cid); |
13749 DW_MUTEX_UNLOCK; | 13749 DW_MUTEX_UNLOCK; |
13750 return; | 13750 return; |
13751 } | 13751 } |
13752 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) | 13752 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
13753 { | 13753 { |
13754 if(thisfunc) | 13754 if(thisfunc) |
13755 { | 13755 { |
13756 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13756 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13757 params[0] = GINT_TO_POINTER(sigid); | 13757 params[0] = GINT_TO_POINTER(sigid); |
13758 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_func", (gpointer)thisfunc); | 13758 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_func", (gpointer)thisfunc); |
13759 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_data", GINT_TO_POINTER(sigid)); | 13759 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_select_child_data", GINT_TO_POINTER(sigid)); |
13760 } | 13760 } |
13761 thisname = "select-child"; | 13761 thisname = "select-child"; |
13762 } | 13762 } |
13763 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) | 13763 else if (GTK_IS_TREE(thiswindow) && strcmp(signame, DW_SIGNAL_TREE_EXPAND) == 0) |
13764 { | 13764 { |
13765 if(thisfunc) | 13765 if(thisfunc) |
13766 { | 13766 { |
13767 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13767 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13768 params[0] = GINT_TO_POINTER(sigid); | 13768 params[0] = GINT_TO_POINTER(sigid); |
13769 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_func", (gpointer)thisfunc); | 13769 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_func", (gpointer)thisfunc); |
13770 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_data", GINT_TO_POINTER(sigid)); | 13770 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_tree_item_expand_data", GINT_TO_POINTER(sigid)); |
13771 } | 13771 } |
13772 DW_MUTEX_UNLOCK; | 13772 DW_MUTEX_UNLOCK; |
13773 return; | 13773 return; |
13774 } | 13774 } |
13775 #endif | 13775 #endif |
13776 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) | 13776 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_ENTER) == 0) |
13777 { | 13777 { |
13778 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, _container_enter_event); | 13778 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, _dw_container_enter_event); |
13779 params[0] = GINT_TO_POINTER(sigid); | 13779 params[0] = GINT_TO_POINTER(sigid); |
13780 params[2] = (void *)thiswindow; | 13780 params[2] = (void *)thiswindow; |
13781 cid = g_signal_connect_data(G_OBJECT(thiswindow), "key_press_event", G_CALLBACK(_container_enter_event), params, _dw_signal_disconnect, 0); | 13781 cid = g_signal_connect_data(G_OBJECT(thiswindow), "key_press_event", G_CALLBACK(_dw_container_enter_event), params, _dw_signal_disconnect, 0); |
13782 _set_signal_handler_id(thiswindow, sigid, cid); | 13782 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13783 | 13783 |
13784 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); | 13784 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); |
13785 thisname = "button_press_event"; | 13785 thisname = "button_press_event"; |
13786 thisfunc = _findsigfunc(DW_SIGNAL_ITEM_ENTER); | 13786 thisfunc = _dw_findsigfunc(DW_SIGNAL_ITEM_ENTER); |
13787 } | 13787 } |
13788 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) | 13788 else if (GTK_IS_CLIST(thiswindow) && strcmp(signame, DW_SIGNAL_ITEM_SELECT) == 0) |
13789 { | 13789 { |
13790 thisname = "select_row"; | 13790 thisname = "select_row"; |
13791 thisfunc = (void *)_container_select_row; | 13791 thisfunc = (void *)_dw_container_select_row; |
13792 } | 13792 } |
13793 else if (GTK_IS_COMBO(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) | 13793 else if (GTK_IS_COMBO(thiswindow) && strcmp(signame, DW_SIGNAL_LIST_SELECT) == 0) |
13794 { | 13794 { |
13795 thisname = "select_child"; | 13795 thisname = "select_child"; |
13796 thiswindow = GTK_COMBO(thiswindow)->list; | 13796 thiswindow = GTK_COMBO(thiswindow)->list; |
13806 thiswindow = GTK_COMBO(thiswindow)->entry; | 13806 thiswindow = GTK_COMBO(thiswindow)->entry; |
13807 } | 13807 } |
13808 #ifdef USE_WEBKIT | 13808 #ifdef USE_WEBKIT |
13809 else if (WEBKIT_IS_WEB_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_HTML_CHANGED) == 0) | 13809 else if (WEBKIT_IS_WEB_VIEW(thiswindow) && strcmp(signame, DW_SIGNAL_HTML_CHANGED) == 0) |
13810 { | 13810 { |
13811 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13811 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13812 params[0] = GINT_TO_POINTER(sigid); | 13812 params[0] = GINT_TO_POINTER(sigid); |
13813 params[2] = (void *)thiswindow; | 13813 params[2] = (void *)thiswindow; |
13814 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_STARTED); | 13814 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_STARTED); |
13815 cid = g_signal_connect_data(G_OBJECT(thiswindow), "load-started", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 13815 cid = g_signal_connect_data(G_OBJECT(thiswindow), "load-started", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
13816 _set_signal_handler_id(thiswindow, sigid, cid); | 13816 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13817 | 13817 |
13818 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); | 13818 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); |
13819 | 13819 |
13820 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13820 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13821 params[0] = GINT_TO_POINTER(sigid); | 13821 params[0] = GINT_TO_POINTER(sigid); |
13822 params[2] = (void *)thiswindow; | 13822 params[2] = (void *)thiswindow; |
13823 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_LOADING); | 13823 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_LOADING); |
13824 cid = g_signal_connect_data(G_OBJECT(thiswindow), "load-committed", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 13824 cid = g_signal_connect_data(G_OBJECT(thiswindow), "load-committed", G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
13825 _set_signal_handler_id(thiswindow, sigid, cid); | 13825 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13826 | 13826 |
13827 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); | 13827 params = calloc(sizeof(void *), _DW_INTERNAL_CALLBACK_PARAMS); |
13828 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_COMPLETE); | 13828 params[3] = GINT_TO_POINTER(DW_HTML_CHANGE_COMPLETE); |
13829 | 13829 |
13830 thisname = "load-finished"; | 13830 thisname = "load-finished"; |
13858 free(params); | 13858 free(params); |
13859 DW_MUTEX_UNLOCK; | 13859 DW_MUTEX_UNLOCK; |
13860 return; | 13860 return; |
13861 } | 13861 } |
13862 | 13862 |
13863 sigid = _set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); | 13863 sigid = _dw_set_signal_handler(thiswindow, window, sigfunc, data, thisfunc); |
13864 params[0] = GINT_TO_POINTER(sigid); | 13864 params[0] = GINT_TO_POINTER(sigid); |
13865 params[2] = (void *)thiswindow; | 13865 params[2] = (void *)thiswindow; |
13866 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); | 13866 cid = g_signal_connect_data(G_OBJECT(thiswindow), thisname, G_CALLBACK(thisfunc), params, _dw_signal_disconnect, 0); |
13867 _set_signal_handler_id(thiswindow, sigid, cid); | 13867 _dw_set_signal_handler_id(thiswindow, sigid, cid); |
13868 DW_MUTEX_UNLOCK; | 13868 DW_MUTEX_UNLOCK; |
13869 } | 13869 } |
13870 | 13870 |
13871 /* | 13871 /* |
13872 * Removes callbacks for a given window with given name. | 13872 * Removes callbacks for a given window with given name. |
13879 void *thisfunc; | 13879 void *thisfunc; |
13880 int _locked_by_me = FALSE; | 13880 int _locked_by_me = FALSE; |
13881 void **params = alloca(sizeof(void *) * 3); | 13881 void **params = alloca(sizeof(void *) * 3); |
13882 | 13882 |
13883 DW_MUTEX_LOCK; | 13883 DW_MUTEX_LOCK; |
13884 params[2] = _find_signal_window(window, signame); | 13884 params[2] = _dw_find_signal_window(window, signame); |
13885 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(params[2]), "_dw_sigcounter")); | 13885 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(params[2]), "_dw_sigcounter")); |
13886 thisfunc = _findsigfunc(signame); | 13886 thisfunc = _dw_findsigfunc(signame); |
13887 | 13887 |
13888 for(z=0;z<count;z++) | 13888 for(z=0;z<count;z++) |
13889 { | 13889 { |
13890 SignalHandler sh; | 13890 DWSignalHandler sh; |
13891 | 13891 |
13892 params[0] = GINT_TO_POINTER(z); | 13892 params[0] = GINT_TO_POINTER(z); |
13893 sh = _get_signal_handler(params); | 13893 sh = _dw_get_signal_handler(params); |
13894 | 13894 |
13895 if(sh.intfunc == thisfunc) | 13895 if(sh.intfunc == thisfunc) |
13896 _remove_signal_handler((HWND)params[2], z); | 13896 _dw_remove_signal_handler((HWND)params[2], z); |
13897 } | 13897 } |
13898 DW_MUTEX_UNLOCK; | 13898 DW_MUTEX_UNLOCK; |
13899 } | 13899 } |
13900 | 13900 |
13901 /* | 13901 /* |
13908 HWND thiswindow; | 13908 HWND thiswindow; |
13909 int z, count; | 13909 int z, count; |
13910 int _locked_by_me = FALSE; | 13910 int _locked_by_me = FALSE; |
13911 | 13911 |
13912 DW_MUTEX_LOCK; | 13912 DW_MUTEX_LOCK; |
13913 thiswindow = _find_signal_window(window, NULL); | 13913 thiswindow = _dw_find_signal_window(window, NULL); |
13914 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter")); | 13914 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(thiswindow), "_dw_sigcounter")); |
13915 | 13915 |
13916 for(z=0;z<count;z++) | 13916 for(z=0;z<count;z++) |
13917 _remove_signal_handler(thiswindow, z); | 13917 _dw_remove_signal_handler(thiswindow, z); |
13918 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_sigcounter", NULL); | 13918 gtk_object_set_data(GTK_OBJECT(thiswindow), "_dw_sigcounter", NULL); |
13919 DW_MUTEX_UNLOCK; | 13919 DW_MUTEX_UNLOCK; |
13920 } | 13920 } |
13921 | 13921 |
13922 /* | 13922 /* |
13930 int z, count; | 13930 int z, count; |
13931 int _locked_by_me = FALSE; | 13931 int _locked_by_me = FALSE; |
13932 void **params = alloca(sizeof(void *) * 3); | 13932 void **params = alloca(sizeof(void *) * 3); |
13933 | 13933 |
13934 DW_MUTEX_LOCK; | 13934 DW_MUTEX_LOCK; |
13935 params[2] = _find_signal_window(window, NULL); | 13935 params[2] = _dw_find_signal_window(window, NULL); |
13936 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(params[2]), "_dw_sigcounter")); | 13936 count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(params[2]), "_dw_sigcounter")); |
13937 | 13937 |
13938 for(z=0;z<count;z++) | 13938 for(z=0;z<count;z++) |
13939 { | 13939 { |
13940 SignalHandler sh; | 13940 DWSignalHandler sh; |
13941 | 13941 |
13942 params[0] = GINT_TO_POINTER(z); | 13942 params[0] = GINT_TO_POINTER(z); |
13943 sh = _get_signal_handler(params); | 13943 sh = _dw_get_signal_handler(params); |
13944 | 13944 |
13945 if(sh.data == data) | 13945 if(sh.data == data) |
13946 _remove_signal_handler((HWND)params[2], z); | 13946 _dw_remove_signal_handler((HWND)params[2], z); |
13947 } | 13947 } |
13948 DW_MUTEX_UNLOCK; | 13948 DW_MUTEX_UNLOCK; |
13949 } | 13949 } |
13950 | 13950 |
13951 /* | 13951 /* |