diff options
| author | Jan Djärv | 2010-07-29 18:49:59 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-07-29 18:49:59 +0200 |
| commit | bfeabdc3d7568d08491eb3eab7249bc6c2c24af3 (patch) | |
| tree | 8d91481669f60b8507911afe7182975c057d53fd /src | |
| parent | 063e52940d4d97fe372f226c895d6d0f9d87f5d4 (diff) | |
| download | emacs-bfeabdc3d7568d08491eb3eab7249bc6c2c24af3.tar.gz emacs-bfeabdc3d7568d08491eb3eab7249bc6c2c24af3.zip | |
Add ability to put Gtk+ tool bar on the left/right/bottom or top. Default top.
* lisp/menu-bar.el (menu-bar-showhide-tool-bar-menu-customize-enable-left)
(menu-bar-showhide-tool-bar-menu-customize-disable)
(menu-bar-showhide-tool-bar-menu-customize-enable-right)
(menu-bar-showhide-tool-bar-menu-customize-enable-top)
(menu-bar-showhide-tool-bar-menu-customize-enable-bottom): New functions
(menu-bar-showhide-tool-bar-menu): If tool bar is moveable,
make a menu for Options => toolbar that can move it.
* src/frame.c (Qtool_bar_position): New variable.
(make_frame): Set tool_bar_position to Qtop.
(frame_parms): Add tool-bar-position.
(x_report_frame_params): Store tool_bar_position.
(x_set_fringe_width): Reset wm size hint after fringe changes.
* src/frame.h (struct frame): Add tool_bar_position.
(Qbottom): Declare.
* src/gtkutil.c (FRAME_TOTAL_PIXEL_WIDTH): New macro.
(xg_frame_set_char_size): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
(xg_height_or_width_changed): Use FRAME_TOTAL_PIXEL_WIDTH.
(xg_create_frame_widgets): Create a hobox for placing widgets
vertically. Use gtk_box_pack_start.
(xg_height_or_width_changed): Renamed from xg_height_changed.
(x_wm_set_size_hint): Add FRAME_TOOLBAR_WIDTH to base_width.
(xg_update_frame_menubar, free_frame_menubar): Change to
xg_height_or_width_changed.
(xg_tool_bar_detach_callback): Update left/right/top/bottom tool bar
size correctly. Remove hardcoded 4, instead use handlebox size -
toolbar size.
(xg_tool_bar_attach_callback): Update left/right/top/bottom tool bar
size correctly. Use handlebox size + toolbar size as additional
size.
(xg_pack_tool_bar): POS is a new parameter.
Set orientation of tool bar based on pos.
Only make handlebox_widget if NULL.
Check if tool bar goes to vbox or hbox depending on pos.
(xg_update_tool_bar_sizes): New function.
(update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar
height, call xg_update_tool_bar_sizes instead.
(free_frame_tool_bar): Remove from hbox or vbox depending on
toolbar_in_hbox, Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero.
(xg_change_toolbar_position): New function.
* src/gtkutil.h (xg_change_toolbar_position): Declare.
* src/window.c (calc_absolute_offset): Check for FRAME_TOOLBAR_TOP_HEIGHT
and FRAME_TOOLBAR_LEFT_WIDTH.
* src/xfns.c (x_set_tool_bar_position): New function.
(xic_set_statusarea): Use FRAME_TOOLBAR_TOP_HEIGHT.
(x_frame_parm_handlers): Add x_set_tool_bar_position.
(syms_of_xfns): if USE_GTK, provide move-toolbar.
* src/xterm.c (x_set_window_size_1): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
* src/xterm.h (struct x_output): Add toolbar_top_height,
toolbar_bottom_height, toolbar_left_width, toolbar_right_width. Remove
toolbar_height.
if USE_GTK: Add hbox_widget and toolbar_in_hbox.
(FRAME_TOOLBAR_TOP_HEIGHT, FRAME_TOOLBAR_BOTTOM_HEIGHT)
(FRAME_TOOLBAR_LEFT_WIDTH, FRAME_TOOLBAR_RIGHT_WIDTH): New macros.
(FRAME_TOOLBAR_HEIGHT): Is now TOP_HEIGHT + BOTTOM_HEIGHT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 57 | ||||
| -rw-r--r-- | src/frame.c | 10 | ||||
| -rw-r--r-- | src/frame.h | 6 | ||||
| -rw-r--r-- | src/gtkutil.c | 248 | ||||
| -rw-r--r-- | src/gtkutil.h | 1 | ||||
| -rw-r--r-- | src/window.c | 7 | ||||
| -rw-r--r-- | src/xfns.c | 21 | ||||
| -rw-r--r-- | src/xterm.c | 3 | ||||
| -rw-r--r-- | src/xterm.h | 26 |
9 files changed, 306 insertions, 73 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6dfd993ede4..1fd18d0abb0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,60 @@ | |||
| 1 | 2010-07-29 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xterm.h (struct x_output): Add toolbar_top_height, | ||
| 4 | toolbar_bottom_height, toolbar_left_width, toolbar_right_width. Remove | ||
| 5 | toolbar_height. | ||
| 6 | if USE_GTK: Add hbox_widget and toolbar_in_hbox. | ||
| 7 | (FRAME_TOOLBAR_TOP_HEIGHT, FRAME_TOOLBAR_BOTTOM_HEIGHT) | ||
| 8 | (FRAME_TOOLBAR_LEFT_WIDTH, FRAME_TOOLBAR_RIGHT_WIDTH): New macros. | ||
| 9 | (FRAME_TOOLBAR_HEIGHT): Is now TOP_HEIGHT + BOTTOM_HEIGHT. | ||
| 10 | |||
| 11 | * xterm.c (x_set_window_size_1): Add FRAME_TOOLBAR_WIDTH to pixelwidth. | ||
| 12 | |||
| 13 | * xfns.c (x_set_tool_bar_position): New function. | ||
| 14 | (xic_set_statusarea): Use FRAME_TOOLBAR_TOP_HEIGHT. | ||
| 15 | (x_frame_parm_handlers): Add x_set_tool_bar_position. | ||
| 16 | (syms_of_xfns): if USE_GTK, provide move-toolbar. | ||
| 17 | |||
| 18 | * window.c (calc_absolute_offset): Check for FRAME_TOOLBAR_TOP_HEIGHT | ||
| 19 | and FRAME_TOOLBAR_LEFT_WIDTH. | ||
| 20 | |||
| 21 | * gtkutil.h (xg_change_toolbar_position): Declare. | ||
| 22 | |||
| 23 | * gtkutil.c (FRAME_TOTAL_PIXEL_WIDTH): New macro. | ||
| 24 | (xg_frame_set_char_size): Add FRAME_TOOLBAR_WIDTH to pixelwidth. | ||
| 25 | (xg_height_or_width_changed): Use FRAME_TOTAL_PIXEL_WIDTH. | ||
| 26 | (xg_create_frame_widgets): Create a hobox for placing widgets | ||
| 27 | vertically. Use gtk_box_pack_start. | ||
| 28 | (xg_height_or_width_changed): Renamed from xg_height_changed. | ||
| 29 | (x_wm_set_size_hint): Add FRAME_TOOLBAR_WIDTH to base_width. | ||
| 30 | (xg_update_frame_menubar, free_frame_menubar): Change to | ||
| 31 | xg_height_or_width_changed. | ||
| 32 | (xg_tool_bar_detach_callback): Update left/right/top/bottom tool bar | ||
| 33 | size correctly. Remove hardcoded 4, instead use handlebox size - | ||
| 34 | toolbar size. | ||
| 35 | (xg_tool_bar_attach_callback): Update left/right/top/bottom tool bar | ||
| 36 | size correctly. Use handlebox size + toolbar size as additional | ||
| 37 | size. | ||
| 38 | (xg_pack_tool_bar): POS is a new parameter. | ||
| 39 | Set orientation of tool bar based on pos. | ||
| 40 | Only make handlebox_widget if NULL. | ||
| 41 | Check if tool bar goes to vbox or hbox depending on pos. | ||
| 42 | (xg_update_tool_bar_sizes): New function. | ||
| 43 | (update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar | ||
| 44 | height, call xg_update_tool_bar_sizes instead. | ||
| 45 | (free_frame_tool_bar): Remove from hbox or vbox depending on | ||
| 46 | toolbar_in_hbox, Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero. | ||
| 47 | (xg_change_toolbar_position): New function. | ||
| 48 | |||
| 49 | * frame.h (struct frame): Add tool_bar_position. | ||
| 50 | (Qbottom): Declare. | ||
| 51 | |||
| 52 | * frame.c (Qtool_bar_position): New variable. | ||
| 53 | (make_frame): Set tool_bar_position to Qtop. | ||
| 54 | (frame_parms): Add tool-bar-position. | ||
| 55 | (x_report_frame_params): Store tool_bar_position. | ||
| 56 | (x_set_fringe_width): Reset wm size hint after fringe changes. | ||
| 57 | |||
| 1 | 2010-07-29 Dan Nicolaescu <dann@ics.uci.edu> | 58 | 2010-07-29 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 59 | ||
| 3 | Make lisp_time_argument declaration work on all systems. | 60 | Make lisp_time_argument declaration work on all systems. |
diff --git a/src/frame.c b/src/frame.c index ae8fdff807d..809f660f1d9 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -119,7 +119,7 @@ Lisp_Object Qparent_id; | |||
| 119 | Lisp_Object Qtitle, Qname; | 119 | Lisp_Object Qtitle, Qname; |
| 120 | Lisp_Object Qexplicit_name; | 120 | Lisp_Object Qexplicit_name; |
| 121 | Lisp_Object Qunsplittable; | 121 | Lisp_Object Qunsplittable; |
| 122 | Lisp_Object Qmenu_bar_lines, Qtool_bar_lines; | 122 | Lisp_Object Qmenu_bar_lines, Qtool_bar_lines, Qtool_bar_position; |
| 123 | Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; | 123 | Lisp_Object Vmenu_bar_mode, Vtool_bar_mode; |
| 124 | Lisp_Object Qleft_fringe, Qright_fringe; | 124 | Lisp_Object Qleft_fringe, Qright_fringe; |
| 125 | Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; | 125 | Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; |
| @@ -323,6 +323,7 @@ make_frame (int mini_p) | |||
| 323 | f->menu_bar_window = Qnil; | 323 | f->menu_bar_window = Qnil; |
| 324 | f->tool_bar_window = Qnil; | 324 | f->tool_bar_window = Qnil; |
| 325 | f->tool_bar_items = Qnil; | 325 | f->tool_bar_items = Qnil; |
| 326 | f->tool_bar_position = Qtop; | ||
| 326 | f->desired_tool_bar_string = f->current_tool_bar_string = Qnil; | 327 | f->desired_tool_bar_string = f->current_tool_bar_string = Qnil; |
| 327 | f->n_tool_bar_items = 0; | 328 | f->n_tool_bar_items = 0; |
| 328 | f->left_fringe_width = f->right_fringe_width = 0; | 329 | f->left_fringe_width = f->right_fringe_width = 0; |
| @@ -2816,6 +2817,7 @@ static struct frame_parm_table frame_parms[] = | |||
| 2816 | {"font-backend", &Qfont_backend}, | 2817 | {"font-backend", &Qfont_backend}, |
| 2817 | {"alpha", &Qalpha}, | 2818 | {"alpha", &Qalpha}, |
| 2818 | {"sticky", &Qsticky}, | 2819 | {"sticky", &Qsticky}, |
| 2820 | {"tool-bar-position", &Qtool_bar_position}, | ||
| 2819 | }; | 2821 | }; |
| 2820 | 2822 | ||
| 2821 | #ifdef HAVE_WINDOW_SYSTEM | 2823 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -3209,6 +3211,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 3209 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); | 3211 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); |
| 3210 | store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); | 3212 | store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); |
| 3211 | store_in_alist (alistptr, Qparent_id, tem); | 3213 | store_in_alist (alistptr, Qparent_id, tem); |
| 3214 | store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position); | ||
| 3212 | } | 3215 | } |
| 3213 | 3216 | ||
| 3214 | 3217 | ||
| @@ -3441,6 +3444,11 @@ void | |||
| 3441 | x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) | 3444 | x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) |
| 3442 | { | 3445 | { |
| 3443 | compute_fringe_widths (f, 1); | 3446 | compute_fringe_widths (f, 1); |
| 3447 | #ifdef HAVE_X_WINDOWS | ||
| 3448 | /* Must adjust this so window managers report correct number of columns. */ | ||
| 3449 | if (FRAME_X_WINDOW (f) != 0) | ||
| 3450 | x_wm_set_size_hint (f, 0, 0); | ||
| 3451 | #endif | ||
| 3444 | } | 3452 | } |
| 3445 | 3453 | ||
| 3446 | void | 3454 | void |
diff --git a/src/frame.h b/src/frame.h index 6ab2b07dd92..3b680d5cadc 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -191,6 +191,10 @@ struct frame | |||
| 191 | /* Desired and current tool-bar items. */ | 191 | /* Desired and current tool-bar items. */ |
| 192 | Lisp_Object tool_bar_items; | 192 | Lisp_Object tool_bar_items; |
| 193 | 193 | ||
| 194 | /* Where tool bar is, can be left, right, top or bottom. The native | ||
| 195 | tool bar only supports top. */ | ||
| 196 | Lisp_Object tool_bar_position; | ||
| 197 | |||
| 194 | /* Desired and current contents displayed in tool_bar_window. */ | 198 | /* Desired and current contents displayed in tool_bar_window. */ |
| 195 | Lisp_Object desired_tool_bar_string, current_tool_bar_string; | 199 | Lisp_Object desired_tool_bar_string, current_tool_bar_string; |
| 196 | 200 | ||
| @@ -1071,7 +1075,7 @@ extern Lisp_Object Qbackground_mode; | |||
| 1071 | 1075 | ||
| 1072 | extern Lisp_Object Qx_resource_name; | 1076 | extern Lisp_Object Qx_resource_name; |
| 1073 | 1077 | ||
| 1074 | extern Lisp_Object Qleft, Qright, Qtop, Qbox; | 1078 | extern Lisp_Object Qleft, Qright, Qtop, Qbox, Qbottom; |
| 1075 | extern Lisp_Object Qdisplay; | 1079 | extern Lisp_Object Qdisplay; |
| 1076 | 1080 | ||
| 1077 | #ifdef HAVE_WINDOW_SYSTEM | 1081 | #ifdef HAVE_WINDOW_SYSTEM |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 3fb05ba1348..b31eb2d21f2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -44,6 +44,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 44 | #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ | 44 | #define FRAME_TOTAL_PIXEL_HEIGHT(f) \ |
| 45 | (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) | 45 | (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) |
| 46 | 46 | ||
| 47 | #define FRAME_TOTAL_PIXEL_WIDTH(f) \ | ||
| 48 | (FRAME_PIXEL_WIDTH (f) + FRAME_TOOLBAR_WIDTH (f)) | ||
| 49 | |||
| 47 | /* Avoid "differ in sign" warnings */ | 50 | /* Avoid "differ in sign" warnings */ |
| 48 | #define SSDATA(x) ((char *) SDATA (x)) | 51 | #define SSDATA(x) ((char *) SDATA (x)) |
| 49 | 52 | ||
| @@ -640,7 +643,8 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) | |||
| 640 | 643 | ||
| 641 | /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it | 644 | /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it |
| 642 | after calculating that value. */ | 645 | after calculating that value. */ |
| 643 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); | 646 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols) |
| 647 | + FRAME_TOOLBAR_WIDTH (f); | ||
| 644 | 648 | ||
| 645 | 649 | ||
| 646 | /* Do this before resize, as we don't know yet if we will be resized. */ | 650 | /* Do this before resize, as we don't know yet if we will be resized. */ |
| @@ -677,14 +681,15 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) | |||
| 677 | } | 681 | } |
| 678 | } | 682 | } |
| 679 | 683 | ||
| 680 | /* Handle height changes (i.e. add/remove menu/toolbar). | 684 | /* Handle height/width changes (i.e. add/remove/move menu/toolbar). |
| 681 | The policy is to keep the number of editable lines. */ | 685 | The policy is to keep the number of editable lines. */ |
| 682 | 686 | ||
| 683 | static void | 687 | static void |
| 684 | xg_height_changed (FRAME_PTR f) | 688 | xg_height_or_width_changed (FRAME_PTR f) |
| 685 | { | 689 | { |
| 686 | gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 690 | gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
| 687 | FRAME_PIXEL_WIDTH (f), FRAME_TOTAL_PIXEL_HEIGHT (f)); | 691 | FRAME_TOTAL_PIXEL_WIDTH (f), |
| 692 | FRAME_TOTAL_PIXEL_HEIGHT (f)); | ||
| 688 | f->output_data.x->hint_flags = 0; | 693 | f->output_data.x->hint_flags = 0; |
| 689 | x_wm_set_size_hint (f, 0, 0); | 694 | x_wm_set_size_hint (f, 0, 0); |
| 690 | } | 695 | } |
| @@ -733,7 +738,7 @@ int | |||
| 733 | xg_create_frame_widgets (FRAME_PTR f) | 738 | xg_create_frame_widgets (FRAME_PTR f) |
| 734 | { | 739 | { |
| 735 | GtkWidget *wtop; | 740 | GtkWidget *wtop; |
| 736 | GtkWidget *wvbox; | 741 | GtkWidget *wvbox, *whbox; |
| 737 | GtkWidget *wfixed; | 742 | GtkWidget *wfixed; |
| 738 | GdkColor bg; | 743 | GdkColor bg; |
| 739 | GtkRcStyle *style; | 744 | GtkRcStyle *style; |
| @@ -749,12 +754,14 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 749 | xg_set_screen (wtop, f); | 754 | xg_set_screen (wtop, f); |
| 750 | 755 | ||
| 751 | wvbox = gtk_vbox_new (FALSE, 0); | 756 | wvbox = gtk_vbox_new (FALSE, 0); |
| 757 | whbox = gtk_hbox_new (FALSE, 0); | ||
| 752 | wfixed = gtk_fixed_new (); /* Must have this to place scroll bars */ | 758 | wfixed = gtk_fixed_new (); /* Must have this to place scroll bars */ |
| 753 | 759 | ||
| 754 | if (! wtop || ! wvbox || ! wfixed) | 760 | if (! wtop || ! wvbox || ! whbox || ! wfixed) |
| 755 | { | 761 | { |
| 756 | if (wtop) gtk_widget_destroy (wtop); | 762 | if (wtop) gtk_widget_destroy (wtop); |
| 757 | if (wvbox) gtk_widget_destroy (wvbox); | 763 | if (wvbox) gtk_widget_destroy (wvbox); |
| 764 | if (whbox) gtk_widget_destroy (whbox); | ||
| 758 | if (wfixed) gtk_widget_destroy (wfixed); | 765 | if (wfixed) gtk_widget_destroy (wfixed); |
| 759 | 766 | ||
| 760 | UNBLOCK_INPUT; | 767 | UNBLOCK_INPUT; |
| @@ -775,11 +782,13 @@ xg_create_frame_widgets (FRAME_PTR f) | |||
| 775 | FRAME_GTK_OUTER_WIDGET (f) = wtop; | 782 | FRAME_GTK_OUTER_WIDGET (f) = wtop; |
| 776 | FRAME_GTK_WIDGET (f) = wfixed; | 783 | FRAME_GTK_WIDGET (f) = wfixed; |
| 777 | f->output_data.x->vbox_widget = wvbox; | 784 | f->output_data.x->vbox_widget = wvbox; |
| 785 | f->output_data.x->hbox_widget = whbox; | ||
| 778 | 786 | ||
| 779 | gtk_widget_set_has_window (wfixed, TRUE); | 787 | gtk_widget_set_has_window (wfixed, TRUE); |
| 780 | 788 | ||
| 781 | gtk_container_add (GTK_CONTAINER (wtop), wvbox); | 789 | gtk_container_add (GTK_CONTAINER (wtop), wvbox); |
| 782 | gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0); | 790 | gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, 0); |
| 791 | gtk_box_pack_start (GTK_BOX (whbox), wfixed, TRUE, TRUE, 0); | ||
| 783 | 792 | ||
| 784 | if (FRAME_EXTERNAL_TOOL_BAR (f)) | 793 | if (FRAME_EXTERNAL_TOOL_BAR (f)) |
| 785 | update_frame_tool_bar (f); | 794 | update_frame_tool_bar (f); |
| @@ -889,7 +898,7 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) | |||
| 889 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); | 898 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); |
| 890 | 899 | ||
| 891 | hint_flags |= GDK_HINT_BASE_SIZE; | 900 | hint_flags |= GDK_HINT_BASE_SIZE; |
| 892 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | 901 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0) + FRAME_TOOLBAR_WIDTH (f); |
| 893 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0) | 902 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0) |
| 894 | + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); | 903 | + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
| 895 | 904 | ||
| @@ -2828,7 +2837,7 @@ xg_update_frame_menubar (FRAME_PTR f) | |||
| 2828 | gtk_widget_show_all (x->menubar_widget); | 2837 | gtk_widget_show_all (x->menubar_widget); |
| 2829 | gtk_widget_size_request (x->menubar_widget, &req); | 2838 | gtk_widget_size_request (x->menubar_widget, &req); |
| 2830 | FRAME_MENUBAR_HEIGHT (f) = req.height; | 2839 | FRAME_MENUBAR_HEIGHT (f) = req.height; |
| 2831 | xg_height_changed (f); | 2840 | xg_height_or_width_changed (f); |
| 2832 | UNBLOCK_INPUT; | 2841 | UNBLOCK_INPUT; |
| 2833 | 2842 | ||
| 2834 | return 1; | 2843 | return 1; |
| @@ -2851,7 +2860,7 @@ free_frame_menubar (FRAME_PTR f) | |||
| 2851 | the container. */ | 2860 | the container. */ |
| 2852 | x->menubar_widget = 0; | 2861 | x->menubar_widget = 0; |
| 2853 | FRAME_MENUBAR_HEIGHT (f) = 0; | 2862 | FRAME_MENUBAR_HEIGHT (f) = 0; |
| 2854 | xg_height_changed (f); | 2863 | xg_height_or_width_changed (f); |
| 2855 | UNBLOCK_INPUT; | 2864 | UNBLOCK_INPUT; |
| 2856 | } | 2865 | } |
| 2857 | } | 2866 | } |
| @@ -3548,13 +3557,21 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox, | |||
| 3548 | 3557 | ||
| 3549 | if (f) | 3558 | if (f) |
| 3550 | { | 3559 | { |
| 3560 | GtkRequisition req, req2; | ||
| 3551 | FRAME_X_OUTPUT (f)->toolbar_detached = 1; | 3561 | FRAME_X_OUTPUT (f)->toolbar_detached = 1; |
| 3552 | 3562 | gtk_widget_size_request (GTK_WIDGET (wbox), &req); | |
| 3553 | /* When detaching a tool bar, not everything dissapear. There are | 3563 | gtk_widget_size_request (w, &req2); |
| 3554 | a few pixels left that are used to drop the tool bar back into | 3564 | req.width -= req2.width; |
| 3555 | place. */ | 3565 | req.height -= req2.height; |
| 3556 | FRAME_TOOLBAR_HEIGHT (f) = 4; | 3566 | if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) |
| 3557 | xg_height_changed (f); | 3567 | FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; |
| 3568 | else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) | ||
| 3569 | FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; | ||
| 3570 | else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) | ||
| 3571 | FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; | ||
| 3572 | else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) | ||
| 3573 | FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; | ||
| 3574 | xg_height_or_width_changed (f); | ||
| 3558 | } | 3575 | } |
| 3559 | } | 3576 | } |
| 3560 | 3577 | ||
| @@ -3575,13 +3592,21 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox, | |||
| 3575 | 3592 | ||
| 3576 | if (f) | 3593 | if (f) |
| 3577 | { | 3594 | { |
| 3578 | GtkRequisition req; | 3595 | GtkRequisition req, req2; |
| 3579 | |||
| 3580 | FRAME_X_OUTPUT (f)->toolbar_detached = 0; | 3596 | FRAME_X_OUTPUT (f)->toolbar_detached = 0; |
| 3581 | 3597 | gtk_widget_size_request (GTK_WIDGET (wbox), &req); | |
| 3582 | gtk_widget_size_request (w, &req); | 3598 | gtk_widget_size_request (w, &req2); |
| 3583 | FRAME_TOOLBAR_HEIGHT (f) = req.height; | 3599 | req.width += req2.width; |
| 3584 | xg_height_changed (f); | 3600 | req.height += req2.height; |
| 3601 | if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) | ||
| 3602 | FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; | ||
| 3603 | else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) | ||
| 3604 | FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; | ||
| 3605 | else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) | ||
| 3606 | FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; | ||
| 3607 | else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) | ||
| 3608 | FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; | ||
| 3609 | xg_height_or_width_changed (f); | ||
| 3585 | } | 3610 | } |
| 3586 | } | 3611 | } |
| 3587 | 3612 | ||
| @@ -3656,41 +3681,63 @@ xg_tool_bar_item_expose_callback (GtkWidget *w, | |||
| 3656 | return FALSE; | 3681 | return FALSE; |
| 3657 | } | 3682 | } |
| 3658 | 3683 | ||
| 3684 | #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION | ||
| 3685 | #define toolbar_set_orientation(w, o) \ | ||
| 3686 | gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o) | ||
| 3687 | #else | ||
| 3688 | #define toolbar_set_orientation(w, o) \ | ||
| 3689 | gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) | ||
| 3690 | #endif | ||
| 3691 | |||
| 3659 | /* Attach a tool bar to frame F. */ | 3692 | /* Attach a tool bar to frame F. */ |
| 3660 | 3693 | ||
| 3661 | static void | 3694 | static void |
| 3662 | xg_pack_tool_bar (FRAME_PTR f) | 3695 | xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) |
| 3663 | { | 3696 | { |
| 3664 | struct x_output *x = f->output_data.x; | 3697 | struct x_output *x = f->output_data.x; |
| 3665 | int vbox_pos = x->menubar_widget ? 1 : 0; | 3698 | int into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); |
| 3666 | |||
| 3667 | x->handlebox_widget = gtk_handle_box_new (); | ||
| 3668 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", | ||
| 3669 | G_CALLBACK (xg_tool_bar_detach_callback), f); | ||
| 3670 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", | ||
| 3671 | G_CALLBACK (xg_tool_bar_attach_callback), f); | ||
| 3672 | |||
| 3673 | gtk_container_add (GTK_CONTAINER (x->handlebox_widget), | ||
| 3674 | x->toolbar_widget); | ||
| 3675 | |||
| 3676 | gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, | ||
| 3677 | FALSE, FALSE, 0); | ||
| 3678 | 3699 | ||
| 3679 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget, | 3700 | toolbar_set_orientation (x->toolbar_widget, |
| 3680 | vbox_pos); | 3701 | into_hbox |
| 3702 | ? GTK_ORIENTATION_VERTICAL | ||
| 3703 | : GTK_ORIENTATION_HORIZONTAL); | ||
| 3704 | if (!x->handlebox_widget) | ||
| 3705 | { | ||
| 3706 | x->handlebox_widget = gtk_handle_box_new (); | ||
| 3707 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", | ||
| 3708 | G_CALLBACK (xg_tool_bar_detach_callback), f); | ||
| 3709 | g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", | ||
| 3710 | G_CALLBACK (xg_tool_bar_attach_callback), f); | ||
| 3711 | gtk_container_add (GTK_CONTAINER (x->handlebox_widget), | ||
| 3712 | x->toolbar_widget); | ||
| 3713 | } | ||
| 3681 | 3714 | ||
| 3682 | gtk_widget_show (x->toolbar_widget); | 3715 | if (into_hbox) |
| 3683 | gtk_widget_show (x->handlebox_widget); | 3716 | { |
| 3717 | gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget, | ||
| 3718 | FALSE, FALSE, 0); | ||
| 3719 | |||
| 3720 | if (EQ (pos, Qleft)) | ||
| 3721 | gtk_box_reorder_child (GTK_BOX (x->hbox_widget), | ||
| 3722 | x->handlebox_widget, | ||
| 3723 | 0); | ||
| 3724 | x->toolbar_in_hbox = 1; | ||
| 3725 | } | ||
| 3726 | else | ||
| 3727 | { | ||
| 3728 | int vbox_pos = x->menubar_widget ? 1 : 0; | ||
| 3729 | gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, | ||
| 3730 | FALSE, FALSE, 0); | ||
| 3731 | |||
| 3732 | if (EQ (pos, Qtop)) | ||
| 3733 | gtk_box_reorder_child (GTK_BOX (x->vbox_widget), | ||
| 3734 | x->handlebox_widget, | ||
| 3735 | vbox_pos); | ||
| 3736 | x->toolbar_in_hbox = 0; | ||
| 3737 | } | ||
| 3684 | } | 3738 | } |
| 3685 | 3739 | ||
| 3686 | /* Create a tool bar for frame F. */ | 3740 | /* Create a tool bar for frame F. */ |
| 3687 | #ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION | ||
| 3688 | #define toolbar_set_orientation(w, o) \ | ||
| 3689 | gtk_orientable_set_orientation (GTK_ORIENTABLE (w), o) | ||
| 3690 | #else | ||
| 3691 | #define toolbar_set_orientation(w, o) \ | ||
| 3692 | gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) | ||
| 3693 | #endif | ||
| 3694 | 3741 | ||
| 3695 | static void | 3742 | static void |
| 3696 | xg_create_tool_bar (FRAME_PTR f) | 3743 | xg_create_tool_bar (FRAME_PTR f) |
| @@ -3875,6 +3922,50 @@ xg_show_toolbar_item (GtkToolItem *ti) | |||
| 3875 | gtk_widget_show (GTK_WIDGET (ti)); | 3922 | gtk_widget_show (GTK_WIDGET (ti)); |
| 3876 | } | 3923 | } |
| 3877 | 3924 | ||
| 3925 | static int | ||
| 3926 | xg_update_tool_bar_sizes (FRAME_PTR f) | ||
| 3927 | { | ||
| 3928 | struct x_output *x = f->output_data.x; | ||
| 3929 | GtkRequisition req; | ||
| 3930 | int nl = 0, nr = 0, nt = 0, nb = 0; | ||
| 3931 | |||
| 3932 | gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req); | ||
| 3933 | if (x->toolbar_in_hbox) | ||
| 3934 | { | ||
| 3935 | int pos; | ||
| 3936 | gtk_container_child_get (GTK_CONTAINER (x->hbox_widget), | ||
| 3937 | x->handlebox_widget, | ||
| 3938 | "position", &pos, NULL); | ||
| 3939 | if (pos == 0) nl = req.width; | ||
| 3940 | else nr = req.width; | ||
| 3941 | } | ||
| 3942 | else | ||
| 3943 | { | ||
| 3944 | int pos; | ||
| 3945 | gtk_container_child_get (GTK_CONTAINER (x->vbox_widget), | ||
| 3946 | x->handlebox_widget, | ||
| 3947 | "position", &pos, NULL); | ||
| 3948 | if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; | ||
| 3949 | else nb = req.height; | ||
| 3950 | } | ||
| 3951 | |||
| 3952 | if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f) | ||
| 3953 | || nr != FRAME_TOOLBAR_RIGHT_WIDTH (f) | ||
| 3954 | || nt != FRAME_TOOLBAR_TOP_HEIGHT (f) | ||
| 3955 | || nb != FRAME_TOOLBAR_BOTTOM_HEIGHT (f)) | ||
| 3956 | { | ||
| 3957 | FRAME_TOOLBAR_RIGHT_WIDTH (f) = FRAME_TOOLBAR_LEFT_WIDTH (f) | ||
| 3958 | = FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; | ||
| 3959 | FRAME_TOOLBAR_LEFT_WIDTH (f) = nl; | ||
| 3960 | FRAME_TOOLBAR_RIGHT_WIDTH (f) = nr; | ||
| 3961 | FRAME_TOOLBAR_TOP_HEIGHT (f) = nt; | ||
| 3962 | FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = nb; | ||
| 3963 | return 1; | ||
| 3964 | } | ||
| 3965 | |||
| 3966 | return 0; | ||
| 3967 | } | ||
| 3968 | |||
| 3878 | 3969 | ||
| 3879 | /* Update the tool bar for frame F. Add new buttons and remove old. */ | 3970 | /* Update the tool bar for frame F. Add new buttons and remove old. */ |
| 3880 | 3971 | ||
| @@ -3884,7 +3975,6 @@ void | |||
| 3884 | update_frame_tool_bar (FRAME_PTR f) | 3975 | update_frame_tool_bar (FRAME_PTR f) |
| 3885 | { | 3976 | { |
| 3886 | int i; | 3977 | int i; |
| 3887 | GtkRequisition old_req, new_req; | ||
| 3888 | struct x_output *x = f->output_data.x; | 3978 | struct x_output *x = f->output_data.x; |
| 3889 | int hmargin = 0, vmargin = 0; | 3979 | int hmargin = 0, vmargin = 0; |
| 3890 | GtkToolbar *wtoolbar; | 3980 | GtkToolbar *wtoolbar; |
| @@ -3925,7 +4015,6 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 3925 | xg_create_tool_bar (f); | 4015 | xg_create_tool_bar (f); |
| 3926 | 4016 | ||
| 3927 | wtoolbar = GTK_TOOLBAR (x->toolbar_widget); | 4017 | wtoolbar = GTK_TOOLBAR (x->toolbar_widget); |
| 3928 | gtk_widget_size_request (GTK_WIDGET (wtoolbar), &old_req); | ||
| 3929 | dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); | 4018 | dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); |
| 3930 | 4019 | ||
| 3931 | for (i = 0; i < f->n_tool_bar_items; ++i) | 4020 | for (i = 0; i < f->n_tool_bar_items; ++i) |
| @@ -4143,18 +4232,16 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4143 | if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); | 4232 | if (ti) gtk_widget_hide_all (GTK_WIDGET (ti)); |
| 4144 | } while (ti != NULL); | 4233 | } while (ti != NULL); |
| 4145 | 4234 | ||
| 4146 | new_req.height = 0; | 4235 | if (f->n_tool_bar_items != 0) |
| 4147 | if (pack_tool_bar && f->n_tool_bar_items != 0) | ||
| 4148 | xg_pack_tool_bar (f); | ||
| 4149 | |||
| 4150 | |||
| 4151 | gtk_widget_size_request (GTK_WIDGET (wtoolbar), &new_req); | ||
| 4152 | if (old_req.height != new_req.height | ||
| 4153 | && ! FRAME_X_OUTPUT (f)->toolbar_detached) | ||
| 4154 | { | 4236 | { |
| 4155 | FRAME_TOOLBAR_HEIGHT (f) = new_req.height; | 4237 | if (pack_tool_bar) |
| 4156 | xg_height_changed (f); | 4238 | xg_pack_tool_bar (f, f->tool_bar_position); |
| 4239 | gtk_widget_show (x->toolbar_widget); | ||
| 4240 | gtk_widget_show (x->handlebox_widget); | ||
| 4241 | if (xg_update_tool_bar_sizes (f)) | ||
| 4242 | xg_height_or_width_changed (f); | ||
| 4157 | } | 4243 | } |
| 4244 | |||
| 4158 | UNBLOCK_INPUT; | 4245 | UNBLOCK_INPUT; |
| 4159 | } | 4246 | } |
| 4160 | 4247 | ||
| @@ -4172,21 +4259,54 @@ free_frame_tool_bar (FRAME_PTR f) | |||
| 4172 | BLOCK_INPUT; | 4259 | BLOCK_INPUT; |
| 4173 | /* We may have created the toolbar_widget in xg_create_tool_bar, but | 4260 | /* We may have created the toolbar_widget in xg_create_tool_bar, but |
| 4174 | not the x->handlebox_widget which is created in xg_pack_tool_bar. */ | 4261 | not the x->handlebox_widget which is created in xg_pack_tool_bar. */ |
| 4175 | if (is_packed) | 4262 | if (is_packed) |
| 4176 | gtk_container_remove (GTK_CONTAINER (x->vbox_widget), | 4263 | { |
| 4177 | x->handlebox_widget); | 4264 | if (x->toolbar_in_hbox) |
| 4265 | gtk_container_remove (GTK_CONTAINER (x->hbox_widget), | ||
| 4266 | x->handlebox_widget); | ||
| 4267 | else | ||
| 4268 | gtk_container_remove (GTK_CONTAINER (x->vbox_widget), | ||
| 4269 | x->handlebox_widget); | ||
| 4270 | } | ||
| 4178 | else | 4271 | else |
| 4179 | gtk_widget_destroy (x->toolbar_widget); | 4272 | gtk_widget_destroy (x->toolbar_widget); |
| 4180 | 4273 | ||
| 4181 | x->toolbar_widget = 0; | 4274 | x->toolbar_widget = 0; |
| 4182 | x->handlebox_widget = 0; | 4275 | x->handlebox_widget = 0; |
| 4183 | FRAME_TOOLBAR_HEIGHT (f) = 0; | 4276 | FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; |
| 4184 | xg_height_changed (f); | 4277 | FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; |
| 4278 | |||
| 4279 | xg_height_or_width_changed (f); | ||
| 4185 | 4280 | ||
| 4186 | UNBLOCK_INPUT; | 4281 | UNBLOCK_INPUT; |
| 4187 | } | 4282 | } |
| 4188 | } | 4283 | } |
| 4189 | 4284 | ||
| 4285 | int | ||
| 4286 | xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) | ||
| 4287 | { | ||
| 4288 | struct x_output *x = f->output_data.x; | ||
| 4289 | |||
| 4290 | if (! x->toolbar_widget || ! x->handlebox_widget) | ||
| 4291 | return 1; | ||
| 4292 | |||
| 4293 | BLOCK_INPUT; | ||
| 4294 | g_object_ref (x->handlebox_widget); | ||
| 4295 | if (x->toolbar_in_hbox) | ||
| 4296 | gtk_container_remove (GTK_CONTAINER (x->hbox_widget), | ||
| 4297 | x->handlebox_widget); | ||
| 4298 | else | ||
| 4299 | gtk_container_remove (GTK_CONTAINER (x->vbox_widget), | ||
| 4300 | x->handlebox_widget); | ||
| 4301 | xg_pack_tool_bar (f, pos); | ||
| 4302 | g_object_unref (x->handlebox_widget); | ||
| 4303 | if (xg_update_tool_bar_sizes (f)) | ||
| 4304 | xg_height_or_width_changed (f); | ||
| 4305 | |||
| 4306 | UNBLOCK_INPUT; | ||
| 4307 | return 1; | ||
| 4308 | } | ||
| 4309 | |||
| 4190 | 4310 | ||
| 4191 | 4311 | ||
| 4192 | /*********************************************************************** | 4312 | /*********************************************************************** |
diff --git a/src/gtkutil.h b/src/gtkutil.h index 14693650de5..3f1d1a2b856 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -181,6 +181,7 @@ extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); | |||
| 181 | 181 | ||
| 182 | extern void update_frame_tool_bar (FRAME_PTR f); | 182 | extern void update_frame_tool_bar (FRAME_PTR f); |
| 183 | extern void free_frame_tool_bar (FRAME_PTR f); | 183 | extern void free_frame_tool_bar (FRAME_PTR f); |
| 184 | extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); | ||
| 184 | 185 | ||
| 185 | extern void xg_frame_resized (FRAME_PTR f, | 186 | extern void xg_frame_resized (FRAME_PTR f, |
| 186 | int pixelwidth, | 187 | int pixelwidth, |
diff --git a/src/window.c b/src/window.c index 662b587150d..3c556fff69b 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -645,13 +645,18 @@ calc_absolute_offset(struct window *w, int *add_x, int *add_y) | |||
| 645 | #ifdef FRAME_MENUBAR_HEIGHT | 645 | #ifdef FRAME_MENUBAR_HEIGHT |
| 646 | *add_y += FRAME_MENUBAR_HEIGHT (f); | 646 | *add_y += FRAME_MENUBAR_HEIGHT (f); |
| 647 | #endif | 647 | #endif |
| 648 | #ifdef FRAME_TOOLBAR_HEIGHT | 648 | #ifdef FRAME_TOOLBAR_TOP_HEIGHT |
| 649 | *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f); | ||
| 650 | #elif FRAME_TOOLBAR_HEIGHT | ||
| 649 | *add_y += FRAME_TOOLBAR_HEIGHT (f); | 651 | *add_y += FRAME_TOOLBAR_HEIGHT (f); |
| 650 | #endif | 652 | #endif |
| 651 | #ifdef FRAME_NS_TITLEBAR_HEIGHT | 653 | #ifdef FRAME_NS_TITLEBAR_HEIGHT |
| 652 | *add_y += FRAME_NS_TITLEBAR_HEIGHT (f); | 654 | *add_y += FRAME_NS_TITLEBAR_HEIGHT (f); |
| 653 | #endif | 655 | #endif |
| 654 | *add_x = f->left_pos; | 656 | *add_x = f->left_pos; |
| 657 | #ifdef FRAME_TOOLBAR_LEFT_WIDTH | ||
| 658 | *add_x += FRAME_TOOLBAR_LEFT_WIDTH (f); | ||
| 659 | #endif | ||
| 655 | } | 660 | } |
| 656 | 661 | ||
| 657 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, | 662 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, |
diff --git a/src/xfns.c b/src/xfns.c index f19498dfb87..6b1a78ba740 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -715,6 +715,23 @@ x_set_wait_for_wm (struct frame *f, Lisp_Object new_value, Lisp_Object old_value | |||
| 715 | f->output_data.x->wait_for_wm = !NILP (new_value); | 715 | f->output_data.x->wait_for_wm = !NILP (new_value); |
| 716 | } | 716 | } |
| 717 | 717 | ||
| 718 | static void | ||
| 719 | x_set_tool_bar_position (struct frame *f, | ||
| 720 | Lisp_Object new_value, | ||
| 721 | Lisp_Object old_value) | ||
| 722 | { | ||
| 723 | if (! EQ (new_value, Qleft) && ! EQ (new_value, Qright) | ||
| 724 | && ! EQ (new_value, Qbottom) && ! EQ (new_value, Qtop)) | ||
| 725 | return; | ||
| 726 | if (EQ (new_value, old_value)) return; | ||
| 727 | |||
| 728 | #ifdef USE_GTK | ||
| 729 | fprintf (stderr, "Pos: %s\n", SDATA (SYMBOL_NAME (new_value))); | ||
| 730 | if (xg_change_toolbar_position (f, new_value)) | ||
| 731 | f->tool_bar_position = new_value; | ||
| 732 | #endif | ||
| 733 | } | ||
| 734 | |||
| 718 | #ifdef USE_GTK | 735 | #ifdef USE_GTK |
| 719 | 736 | ||
| 720 | /* Set icon from FILE for frame F. By using GTK functions the icon | 737 | /* Set icon from FILE for frame F. By using GTK functions the icon |
| @@ -2344,7 +2361,7 @@ xic_set_statusarea (struct frame *f) | |||
| 2344 | area.x = FRAME_PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f); | 2361 | area.x = FRAME_PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f); |
| 2345 | area.y = (FRAME_PIXEL_HEIGHT (f) - area.height | 2362 | area.y = (FRAME_PIXEL_HEIGHT (f) - area.height |
| 2346 | - FRAME_MENUBAR_HEIGHT (f) | 2363 | - FRAME_MENUBAR_HEIGHT (f) |
| 2347 | - FRAME_TOOLBAR_HEIGHT (f) | 2364 | - FRAME_TOOLBAR_TOP_HEIGHT (f) |
| 2348 | - FRAME_INTERNAL_BORDER_WIDTH (f)); | 2365 | - FRAME_INTERNAL_BORDER_WIDTH (f)); |
| 2349 | XFree (needed); | 2366 | XFree (needed); |
| 2350 | 2367 | ||
| @@ -5747,6 +5764,7 @@ frame_parm_handler x_frame_parm_handlers[] = | |||
| 5747 | x_set_font_backend, | 5764 | x_set_font_backend, |
| 5748 | x_set_alpha, | 5765 | x_set_alpha, |
| 5749 | x_set_sticky, | 5766 | x_set_sticky, |
| 5767 | x_set_tool_bar_position, | ||
| 5750 | }; | 5768 | }; |
| 5751 | 5769 | ||
| 5752 | void | 5770 | void |
| @@ -5897,6 +5915,7 @@ the tool bar buttons. */); | |||
| 5897 | accepts --with-x-toolkit=gtk. */ | 5915 | accepts --with-x-toolkit=gtk. */ |
| 5898 | Fprovide (intern_c_string ("x-toolkit"), Qnil); | 5916 | Fprovide (intern_c_string ("x-toolkit"), Qnil); |
| 5899 | Fprovide (intern_c_string ("gtk"), Qnil); | 5917 | Fprovide (intern_c_string ("gtk"), Qnil); |
| 5918 | Fprovide (intern_c_string ("move-toolbar"), Qnil); | ||
| 5900 | 5919 | ||
| 5901 | DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, | 5920 | DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, |
| 5902 | doc: /* Version info for GTK+. */); | 5921 | doc: /* Version info for GTK+. */); |
diff --git a/src/xterm.c b/src/xterm.c index e51c1fad837..61e93470cbd 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8610,7 +8610,8 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows) | |||
| 8610 | 8610 | ||
| 8611 | compute_fringe_widths (f, 0); | 8611 | compute_fringe_widths (f, 0); |
| 8612 | 8612 | ||
| 8613 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); | 8613 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols) |
| 8614 | + FRAME_TOOLBAR_WIDTH (f); | ||
| 8614 | pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) | 8615 | pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) |
| 8615 | + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); | 8616 | + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
| 8616 | 8617 | ||
diff --git a/src/xterm.h b/src/xterm.h index cfc786632e5..c487ae4bd63 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -433,9 +433,15 @@ struct x_output | |||
| 433 | if the menubar is turned off. */ | 433 | if the menubar is turned off. */ |
| 434 | int menubar_height; | 434 | int menubar_height; |
| 435 | 435 | ||
| 436 | /* Height of tool bar widget, in pixels. | 436 | /* Height of tool bar widget, in pixels. top_height is used if tool bar |
| 437 | Zero if not using an external tool bar. */ | 437 | at top, bottom_height if tool bar is at the bottom. |
| 438 | int toolbar_height; | 438 | Zero if not using an external tool bar or if tool bar is vertical. */ |
| 439 | int toolbar_top_height, toolbar_bottom_height; | ||
| 440 | |||
| 441 | /* Width of tool bar widget, in pixels. left_width is used if tool bar | ||
| 442 | at left, right_width if tool bar is at the right. | ||
| 443 | Zero if not using an external tool bar or if tool bar is horizontal. */ | ||
| 444 | int toolbar_left_width, toolbar_right_width; | ||
| 439 | 445 | ||
| 440 | /* The tiled border used when the mouse is out of the frame. */ | 446 | /* The tiled border used when the mouse is out of the frame. */ |
| 441 | Pixmap border_tile; | 447 | Pixmap border_tile; |
| @@ -480,6 +486,8 @@ struct x_output | |||
| 480 | GtkWidget *edit_widget; | 486 | GtkWidget *edit_widget; |
| 481 | /* The widget used for laying out widgets vertically. */ | 487 | /* The widget used for laying out widgets vertically. */ |
| 482 | GtkWidget *vbox_widget; | 488 | GtkWidget *vbox_widget; |
| 489 | /* The widget used for laying out widgets horizontally. */ | ||
| 490 | GtkWidget *hbox_widget; | ||
| 483 | /* The menubar in this frame. */ | 491 | /* The menubar in this frame. */ |
| 484 | GtkWidget *menubar_widget; | 492 | GtkWidget *menubar_widget; |
| 485 | /* The tool bar in this frame */ | 493 | /* The tool bar in this frame */ |
| @@ -488,6 +496,8 @@ struct x_output | |||
| 488 | GtkWidget *handlebox_widget; | 496 | GtkWidget *handlebox_widget; |
| 489 | /* Non-zero if the tool bar is detached. */ | 497 | /* Non-zero if the tool bar is detached. */ |
| 490 | int toolbar_detached; | 498 | int toolbar_detached; |
| 499 | /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */ | ||
| 500 | int toolbar_in_hbox; | ||
| 491 | 501 | ||
| 492 | /* The last size hints set. */ | 502 | /* The last size hints set. */ |
| 493 | GdkGeometry size_hints; | 503 | GdkGeometry size_hints; |
| @@ -700,7 +710,15 @@ enum | |||
| 700 | #define FRAME_FONT(f) ((f)->output_data.x->font) | 710 | #define FRAME_FONT(f) ((f)->output_data.x->font) |
| 701 | #define FRAME_FONTSET(f) ((f)->output_data.x->fontset) | 711 | #define FRAME_FONTSET(f) ((f)->output_data.x->fontset) |
| 702 | #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height) | 712 | #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height) |
| 703 | #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height) | 713 | #define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.x->toolbar_top_height) |
| 714 | #define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \ | ||
| 715 | ((f)->output_data.x->toolbar_bottom_height) | ||
| 716 | #define FRAME_TOOLBAR_HEIGHT(f) \ | ||
| 717 | (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f)) | ||
| 718 | #define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.x->toolbar_left_width) | ||
| 719 | #define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.x->toolbar_right_width) | ||
| 720 | #define FRAME_TOOLBAR_WIDTH(f) \ | ||
| 721 | (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f)) | ||
| 704 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset) | 722 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset) |
| 705 | 723 | ||
| 706 | /* This gives the x_display_info structure for the display F is on. */ | 724 | /* This gives the x_display_info structure for the display F is on. */ |