aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2008-03-30 17:38:09 +0000
committerJan Djärv2008-03-30 17:38:09 +0000
commit1c9c12709b3c95b5952cdb9b84c51bd983a6a724 (patch)
tree1153d61e05240bc80d88fc378bfb75695aa30dd2 /src
parent236b5827555913694962172b56a3fa91c3b2de6b (diff)
downloademacs-1c9c12709b3c95b5952cdb9b84c51bd983a6a724.tar.gz
emacs-1c9c12709b3c95b5952cdb9b84c51bd983a6a724.zip
(xg_set_geometry): Fix indentation.
(xg_resize_outer_widget): Removed (x_wm_size_hint_off): Fix indentation. (xg_frame_set_char_size): Call flush_and_sync after gtk_window_resize. (x_wm_set_size_hint): Pass NULL as geometry window to gtk_window_set_geometry_hints due to Gtk+ bug nr 68668. Add menu bar and tool bar height to base height. (xg_update_frame_menubar, free_frame_menubar) (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback) (update_frame_tool_bar, free_frame_tool_bar): Change xg_resize_outer_widget to xg_frame_set_char_size.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/gtkutil.c123
2 files changed, 69 insertions, 69 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8a9337a66d9..45ba86df1b3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12008-03-30 Jan Djärv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (xg_set_geometry): Fix indentation.
4 (xg_resize_outer_widget): Removed
5 (x_wm_size_hint_off): Fix indentation.
6 (xg_frame_set_char_size): Call flush_and_sync after
7 gtk_window_resize.
8 (x_wm_set_size_hint): Pass NULL as geometry window to
9 gtk_window_set_geometry_hints due to Gtk+ bug nr 68668.
10 Add menu bar and tool bar height to base height.
11 (xg_update_frame_menubar, free_frame_menubar)
12 (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback)
13 (update_frame_tool_bar, free_frame_tool_bar): Change
14 xg_resize_outer_widget to xg_frame_set_char_size.
15
12008-03-30 Michael Albinus <michael.albinus@gmx.de> 162008-03-30 Michael Albinus <michael.albinus@gmx.de>
2 17
3 * dbusbind.c (QCdbus_timeout): New D-Bus internal symbol. 18 * dbusbind.c (QCdbus_timeout): New D-Bus internal symbol.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 0881f5bdd5e..fa8483055b3 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -603,52 +603,34 @@ xg_set_geometry (f)
603 FRAME_PTR f; 603 FRAME_PTR f;
604{ 604{
605 if (f->size_hint_flags & USPosition) 605 if (f->size_hint_flags & USPosition)
606 { 606 {
607 int left = f->left_pos; 607 int left = f->left_pos;
608 int xneg = f->size_hint_flags & XNegative; 608 int xneg = f->size_hint_flags & XNegative;
609 int top = f->top_pos; 609 int top = f->top_pos;
610 int yneg = f->size_hint_flags & YNegative; 610 int yneg = f->size_hint_flags & YNegative;
611 char geom_str[32]; 611 char geom_str[32];
612 612
613 if (xneg) 613 if (xneg)
614 left = -left; 614 left = -left;
615 if (yneg) 615 if (yneg)
616 top = -top; 616 top = -top;
617 617
618 sprintf (geom_str, "=%dx%d%c%d%c%d", 618 sprintf (geom_str, "=%dx%d%c%d%c%d",
619 FRAME_PIXEL_WIDTH (f), 619 FRAME_PIXEL_WIDTH (f),
620 FRAME_TOTAL_PIXEL_HEIGHT (f), 620 FRAME_TOTAL_PIXEL_HEIGHT (f),
621 (xneg ? '-' : '+'), left, 621 (xneg ? '-' : '+'), left,
622 (yneg ? '-' : '+'), top); 622 (yneg ? '-' : '+'), top);
623 623
624 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 624 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
625 geom_str)) 625 geom_str))
626 fprintf (stderr, "Failed to parse: '%s'\n", geom_str); 626 fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
627 } else if (f->size_hint_flags & PPosition) { 627 }
628 else if (f->size_hint_flags & PPosition)
628 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 629 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
629 f->left_pos, f->top_pos); 630 f->left_pos, f->top_pos);
630 }
631} 631}
632 632
633 633
634/* Resize the outer window of frame F after chainging the height.
635 This happend when the menu bar or the tool bar is added or removed.
636 COLUMNS/ROWS is the size the edit area shall have after the resize. */
637
638static void
639xg_resize_outer_widget (f, columns, rows)
640 FRAME_PTR f;
641 int columns;
642 int rows;
643{
644 /* If we are not mapped yet, set geometry once again, as window
645 height now have changed. */
646 if (! GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f)))
647 xg_set_geometry (f);
648 else
649 xg_frame_set_char_size (f, columns, rows);
650}
651
652/* Function to handle resize of our frame. As we have a Gtk+ tool bar 634/* Function to handle resize of our frame. As we have a Gtk+ tool bar
653 and a Gtk+ menu bar, we get resize events for the edit part of the 635 and a Gtk+ menu bar, we get resize events for the edit part of the
654 frame only. We let Gtk+ deal with the Gtk+ parts. 636 frame only. We let Gtk+ deal with the Gtk+ parts.
@@ -705,27 +687,29 @@ static void
705x_wm_size_hint_off (f) 687x_wm_size_hint_off (f)
706 FRAME_PTR f; 688 FRAME_PTR f;
707{ 689{
708 GdkGeometry size_hints; 690 GdkGeometry size_hints;
709 gint hint_flags = 0; 691 gint hint_flags = 0;
710 memset (&size_hints, 0, sizeof (size_hints)); 692 memset (&size_hints, 0, sizeof (size_hints));
711 hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE; 693 hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
712 size_hints.width_inc = 1; 694 size_hints.width_inc = 1;
713 size_hints.height_inc = 1; 695 size_hints.height_inc = 1;
714 hint_flags |= GDK_HINT_BASE_SIZE; 696 hint_flags |= GDK_HINT_BASE_SIZE;
715 size_hints.base_width = 1; 697 size_hints.base_width = 1;
716 size_hints.base_height = 1; 698 size_hints.base_height = 1;
717 size_hints.min_width = 1; 699 size_hints.min_width = 1;
718 size_hints.min_height = 1; 700 size_hints.min_height = 1;
719 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 701 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
720 FRAME_GTK_WIDGET (f), 702 NULL,
721 &size_hints, 703 &size_hints,
722 hint_flags); 704 hint_flags);
723 /* Make sure these get set again in next call to x_wm_set_size_hint. */ 705 /* Make sure these get set again in next call to x_wm_set_size_hint. */
724 f->output_data.x->hint_flags &= ~hint_flags; 706 f->output_data.x->hint_flags &= ~hint_flags;
725 flush_and_sync (f); 707 flush_and_sync (f);
726} 708}
727 709
728/* Update our widget size to be COLS/ROWS characters for frame F. */ 710/* Resize the outer window of frame F after chainging the height.
711 This happend when the menu bar or the tool bar is added or removed.
712 COLUMNS/ROWS is the size the edit area shall have after the resize. */
729 713
730void 714void
731xg_frame_set_char_size (f, cols, rows) 715xg_frame_set_char_size (f, cols, rows)
@@ -754,7 +738,6 @@ xg_frame_set_char_size (f, cols, rows)
754 after calculating that value. */ 738 after calculating that value. */
755 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); 739 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
756 740
757
758 /* Must resize our top level widget. Font size may have changed, 741 /* Must resize our top level widget. Font size may have changed,
759 but not rows/cols. 742 but not rows/cols.
760 Turn wm hints (min/max size and size increments) of temporarly. 743 Turn wm hints (min/max size and size increments) of temporarly.
@@ -763,6 +746,7 @@ xg_frame_set_char_size (f, cols, rows)
763 x_wm_size_hint_off (f); 746 x_wm_size_hint_off (f);
764 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 747 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
765 pixelwidth, pixelheight); 748 pixelwidth, pixelheight);
749 flush_and_sync (f);
766 x_wm_set_size_hint (f, 0, 0); 750 x_wm_set_size_hint (f, 0, 0);
767} 751}
768 752
@@ -975,7 +959,8 @@ x_wm_set_size_hint (f, flags, user_position)
975 959
976 hint_flags |= GDK_HINT_BASE_SIZE; 960 hint_flags |= GDK_HINT_BASE_SIZE;
977 base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); 961 base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
978 base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); 962 base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0)
963 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
979 964
980 check_frame_size (f, &min_rows, &min_cols); 965 check_frame_size (f, &min_rows, &min_cols);
981 966
@@ -1028,7 +1013,7 @@ x_wm_set_size_hint (f, flags, user_position)
1028 BLOCK_INPUT; 1013 BLOCK_INPUT;
1029 1014
1030 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1015 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1031 FRAME_GTK_WIDGET (f), 1016 NULL,
1032 &size_hints, 1017 &size_hints,
1033 hint_flags); 1018 hint_flags);
1034 1019
@@ -2960,7 +2945,7 @@ xg_update_frame_menubar (f)
2960 2945
2961 /* The height has changed, resize outer widget and set columns 2946 /* The height has changed, resize outer widget and set columns
2962 rows to what we had before adding the menu bar. */ 2947 rows to what we had before adding the menu bar. */
2963 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 2948 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
2964 2949
2965 SET_FRAME_GARBAGED (f); 2950 SET_FRAME_GARBAGED (f);
2966 UNBLOCK_INPUT; 2951 UNBLOCK_INPUT;
@@ -2989,7 +2974,7 @@ free_frame_menubar (f)
2989 2974
2990 /* The height has changed, resize outer widget and set columns 2975 /* The height has changed, resize outer widget and set columns
2991 rows to what we had before removing the menu bar. */ 2976 rows to what we had before removing the menu bar. */
2992 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 2977 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
2993 2978
2994 SET_FRAME_GARBAGED (f); 2979 SET_FRAME_GARBAGED (f);
2995 UNBLOCK_INPUT; 2980 UNBLOCK_INPUT;
@@ -3593,7 +3578,7 @@ xg_tool_bar_detach_callback (wbox, w, client_data)
3593 3578
3594 /* The height has changed, resize outer widget and set columns 3579 /* The height has changed, resize outer widget and set columns
3595 rows to what we had before detaching the tool bar. */ 3580 rows to what we had before detaching the tool bar. */
3596 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 3581 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
3597 } 3582 }
3598} 3583}
3599 3584
@@ -3624,7 +3609,7 @@ xg_tool_bar_attach_callback (wbox, w, client_data)
3624 3609
3625 /* The height has changed, resize outer widget and set columns 3610 /* The height has changed, resize outer widget and set columns
3626 rows to what we had before attaching the tool bar. */ 3611 rows to what we had before attaching the tool bar. */
3627 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 3612 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
3628 } 3613 }
3629} 3614}
3630 3615
@@ -4122,7 +4107,7 @@ update_frame_tool_bar (f)
4122 && ! FRAME_X_OUTPUT (f)->toolbar_detached) 4107 && ! FRAME_X_OUTPUT (f)->toolbar_detached)
4123 { 4108 {
4124 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; 4109 FRAME_TOOLBAR_HEIGHT (f) = new_req.height;
4125 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 4110 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
4126 } 4111 }
4127 4112
4128 UNBLOCK_INPUT; 4113 UNBLOCK_INPUT;
@@ -4155,7 +4140,7 @@ free_frame_tool_bar (f)
4155 4140
4156 /* The height has changed, resize outer widget and set columns 4141 /* The height has changed, resize outer widget and set columns
4157 rows to what we had before removing the tool bar. */ 4142 rows to what we had before removing the tool bar. */
4158 xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); 4143 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
4159 UNBLOCK_INPUT; 4144 UNBLOCK_INPUT;
4160 } 4145 }
4161} 4146}