Mercurial > emacs
comparison src/gtkutil.c @ 90072:cb67264d6096
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12
Remove "-face" suffix from lazy-highlight face name
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22
<no summary provided>
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40
Fix regressions from latest reftex update
* miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0
tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2
Merge from miles@gnu.org--gnu-2004
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3
Merge from emacs--cvs-trunk--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 16 Jan 2005 03:40:12 +0000 |
parents | 95879cc1ed20 eb72706060ad |
children | 6d92d69fae33 |
comparison
equal
deleted
inserted
replaced
90071:f6b4d0ebf147 | 90072:cb67264d6096 |
---|---|
754 This makes geometry handling difficult, for example -0-0 will end | 754 This makes geometry handling difficult, for example -0-0 will end |
755 up in the wrong place as tool bar height has not been taken into account. | 755 up in the wrong place as tool bar height has not been taken into account. |
756 So we cheat a bit by setting a height that is what it will have | 756 So we cheat a bit by setting a height that is what it will have |
757 later on when tool bar items are added. */ | 757 later on when tool bar items are added. */ |
758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) | 758 if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) |
759 FRAME_TOOLBAR_HEIGHT (f) = 34; | 759 FRAME_TOOLBAR_HEIGHT (f) = 38; |
760 | 760 |
761 | 761 |
762 /* We don't want this widget double buffered, because we draw on it | 762 /* We don't want this widget double buffered, because we draw on it |
763 with regular X drawing primitives, so from a GTK/GDK point of | 763 with regular X drawing primitives, so from a GTK/GDK point of |
764 view, the widget is totally blank. When an expose comes, this | 764 view, the widget is totally blank. When an expose comes, this |
2848 xg_gtk_scroll_destroy (widget, data) | 2848 xg_gtk_scroll_destroy (widget, data) |
2849 GtkWidget *widget; | 2849 GtkWidget *widget; |
2850 gpointer data; | 2850 gpointer data; |
2851 { | 2851 { |
2852 gpointer p; | 2852 gpointer p; |
2853 int id = (int)data; | 2853 int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */ |
2854 | 2854 |
2855 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); | 2855 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); |
2856 if (p) xfree (p); | 2856 if (p) xfree (p); |
2857 xg_remove_widget_from_map (id); | 2857 xg_remove_widget_from_map (id); |
2858 } | 2858 } |
2918 | 2918 |
2919 g_signal_connect (G_OBJECT (wscroll), | 2919 g_signal_connect (G_OBJECT (wscroll), |
2920 "value-changed", | 2920 "value-changed", |
2921 scroll_callback, | 2921 scroll_callback, |
2922 (gpointer) bar); | 2922 (gpointer) bar); |
2923 /* The EMACS_INT cast avoids a warning. */ | |
2923 g_signal_connect (G_OBJECT (wscroll), | 2924 g_signal_connect (G_OBJECT (wscroll), |
2924 "destroy", | 2925 "destroy", |
2925 G_CALLBACK (xg_gtk_scroll_destroy), | 2926 G_CALLBACK (xg_gtk_scroll_destroy), |
2926 (gpointer) scroll_id); | 2927 (gpointer) (EMACS_INT) scroll_id); |
2927 | 2928 |
2928 /* Connect to button press and button release to detect if any scroll bar | 2929 /* Connect to button press and button release to detect if any scroll bar |
2929 has the pointer. */ | 2930 has the pointer. */ |
2930 g_signal_connect (G_OBJECT (wscroll), | 2931 g_signal_connect (G_OBJECT (wscroll), |
2931 "button-press-event", | 2932 "button-press-event", |
3110 static void | 3111 static void |
3111 xg_tool_bar_callback (w, client_data) | 3112 xg_tool_bar_callback (w, client_data) |
3112 GtkWidget *w; | 3113 GtkWidget *w; |
3113 gpointer client_data; | 3114 gpointer client_data; |
3114 { | 3115 { |
3115 int idx = (int)client_data; | 3116 /* The EMACS_INT cast avoids a warning. */ |
3117 int idx = (int) (EMACS_INT) client_data; | |
3116 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); | 3118 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); |
3117 Lisp_Object key, frame; | 3119 Lisp_Object key, frame; |
3118 struct input_event event; | 3120 struct input_event event; |
3119 EVENT_INIT (event); | 3121 EVENT_INIT (event); |
3120 | 3122 |
3152 { | 3154 { |
3153 FRAME_PTR f = (FRAME_PTR) client_data; | 3155 FRAME_PTR f = (FRAME_PTR) client_data; |
3154 | 3156 |
3155 if (f) | 3157 if (f) |
3156 { | 3158 { |
3159 FRAME_X_OUTPUT (f)->toolbar_detached = 1; | |
3160 | |
3157 /* When detaching a tool bar, not everything dissapear. There are | 3161 /* When detaching a tool bar, not everything dissapear. There are |
3158 a few pixels left that are used to drop the tool bar back into | 3162 a few pixels left that are used to drop the tool bar back into |
3159 place. */ | 3163 place. */ |
3160 int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox)); | 3164 int bw = gtk_container_get_border_width (GTK_CONTAINER (wbox)); |
3161 FRAME_TOOLBAR_HEIGHT (f) = 2; | 3165 FRAME_TOOLBAR_HEIGHT (f) = 2; |
3183 | 3187 |
3184 if (f) | 3188 if (f) |
3185 { | 3189 { |
3186 GtkRequisition req; | 3190 GtkRequisition req; |
3187 | 3191 |
3192 FRAME_X_OUTPUT (f)->toolbar_detached = 0; | |
3193 | |
3188 gtk_widget_size_request (w, &req); | 3194 gtk_widget_size_request (w, &req); |
3189 FRAME_TOOLBAR_HEIGHT (f) = req.height; | 3195 FRAME_TOOLBAR_HEIGHT (f) = req.height; |
3190 | 3196 |
3191 /* The height has changed, resize outer widget and set columns | 3197 /* The height has changed, resize outer widget and set columns |
3192 rows to what we had before detaching the tool bar. */ | 3198 rows to what we had before attaching the tool bar. */ |
3193 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3199 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3194 } | 3200 } |
3195 } | 3201 } |
3196 | 3202 |
3197 /* This callback is called when the mouse enters or leaves a tool bar item. | 3203 /* This callback is called when the mouse enters or leaves a tool bar item. |
3207 xg_tool_bar_help_callback (w, event, client_data) | 3213 xg_tool_bar_help_callback (w, event, client_data) |
3208 GtkWidget *w; | 3214 GtkWidget *w; |
3209 GdkEventCrossing *event; | 3215 GdkEventCrossing *event; |
3210 gpointer client_data; | 3216 gpointer client_data; |
3211 { | 3217 { |
3212 int idx = (int)client_data; | 3218 /* The EMACS_INT cast avoids a warning. */ |
3219 int idx = (int) (EMACS_INT) client_data; | |
3213 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); | 3220 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); |
3214 Lisp_Object help, frame; | 3221 Lisp_Object help, frame; |
3215 | 3222 |
3216 if (! GTK_IS_BUTTON (w)) | 3223 if (! GTK_IS_BUTTON (w)) |
3217 { | 3224 { |
3300 GtkRequisition req; | 3307 GtkRequisition req; |
3301 int vbox_pos = x->menubar_widget ? 1 : 0; | 3308 int vbox_pos = x->menubar_widget ? 1 : 0; |
3302 | 3309 |
3303 x->toolbar_widget = gtk_toolbar_new (); | 3310 x->toolbar_widget = gtk_toolbar_new (); |
3304 x->handlebox_widget = gtk_handle_box_new (); | 3311 x->handlebox_widget = gtk_handle_box_new (); |
3312 x->toolbar_detached = 0; | |
3313 | |
3305 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), | 3314 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
3306 x->toolbar_widget); | 3315 x->toolbar_widget); |
3307 | 3316 |
3308 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, | 3317 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, |
3309 FALSE, FALSE, 0); | 3318 FALSE, FALSE, 0); |
3450 { | 3459 { |
3451 GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 3460 GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
3452 | 3461 |
3453 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | 3462 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); |
3454 | 3463 |
3464 /* The EMACS_INT cast avoids a warning. */ | |
3455 gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3465 gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), |
3456 0, 0, 0, | 3466 0, 0, 0, |
3457 w, | 3467 w, |
3458 GTK_SIGNAL_FUNC (xg_tool_bar_callback), | 3468 GTK_SIGNAL_FUNC (xg_tool_bar_callback), |
3459 (gpointer)i); | 3469 (gpointer) (EMACS_INT) i); |
3460 | 3470 |
3461 /* Save the image so we can see if an update is needed when | 3471 /* Save the image so we can see if an update is needed when |
3462 this function is called again. */ | 3472 this function is called again. */ |
3463 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, | 3473 g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA, |
3464 (gpointer)img->pixmap); | 3474 (gpointer)img->pixmap); |
3484 | 3494 |
3485 /* Use enter/leave notify to show help. We use the events | 3495 /* Use enter/leave notify to show help. We use the events |
3486 rather than the GtkButton specific signals "enter" and | 3496 rather than the GtkButton specific signals "enter" and |
3487 "leave", so we can have only one callback. The event | 3497 "leave", so we can have only one callback. The event |
3488 will tell us what kind of event it is. */ | 3498 will tell us what kind of event it is. */ |
3499 /* The EMACS_INT cast avoids a warning. */ | |
3489 g_signal_connect (G_OBJECT (w), | 3500 g_signal_connect (G_OBJECT (w), |
3490 "enter-notify-event", | 3501 "enter-notify-event", |
3491 G_CALLBACK (xg_tool_bar_help_callback), | 3502 G_CALLBACK (xg_tool_bar_help_callback), |
3492 (gpointer)i); | 3503 (gpointer) (EMACS_INT) i); |
3493 g_signal_connect (G_OBJECT (w), | 3504 g_signal_connect (G_OBJECT (w), |
3494 "leave-notify-event", | 3505 "leave-notify-event", |
3495 G_CALLBACK (xg_tool_bar_help_callback), | 3506 G_CALLBACK (xg_tool_bar_help_callback), |
3496 (gpointer)i); | 3507 (gpointer) (EMACS_INT) i); |
3497 } | 3508 } |
3498 } | 3509 } |
3499 else | 3510 else |
3500 { | 3511 { |
3501 /* The child of the tool bar is a button. Inside that button | 3512 /* The child of the tool bar is a button. Inside that button |
3530 gtk_widget_hide (w); | 3541 gtk_widget_hide (w); |
3531 iter = g_list_next (iter); | 3542 iter = g_list_next (iter); |
3532 } | 3543 } |
3533 | 3544 |
3534 gtk_widget_size_request (x->toolbar_widget, &new_req); | 3545 gtk_widget_size_request (x->toolbar_widget, &new_req); |
3535 if (old_req.height != new_req.height) | 3546 if (old_req.height != new_req.height |
3547 && ! FRAME_X_OUTPUT (f)->toolbar_detached) | |
3536 { | 3548 { |
3537 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; | 3549 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
3538 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3550 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
3539 } | 3551 } |
3540 | 3552 |