aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2012-12-30 19:44:00 +0100
committerJan Djärv2012-12-30 19:44:00 +0100
commit5a1d858bbc5410916d764e7f9c62b4e405fab592 (patch)
treef9d46c3356448d4647ce13352a30acc1b1e116c7 /src
parentd5e5e7b41166815a843148f2081d19bc14b628b2 (diff)
downloademacs-5a1d858bbc5410916d764e7f9c62b4e405fab592.tar.gz
emacs-5a1d858bbc5410916d764e7f9c62b4e405fab592.zip
Check for deprecated gtk_handle_box in configure.
* configure.ac: Check for GtkHandlebox. * src/gtkutil.c (TOOLBAR_TOP_WIDGET): New macro. (xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of handlebox_widget. Set toolbar_in_hbox to false/true, set toolbar_is_packed to true. (xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET. (update_frame_tool_bar): Check toolbar_is_packed for packing. Show all on TOOLBAR_TOP_WIDGET. (free_frame_tool_bar): Check toolbar_is_packed. Use widget returned by TOOLBAR_TOP_WIDGET. (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET. Check toolbar_is_packed. * src/xterm.h (struct x_output): Surround handlebox_widget with #ifdef HAVE_GTK_HANDLE_BOX_NEW. toolbar_is_packed is new, toolbar_in_hbox is bool.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/gtkutil.c75
-rw-r--r--src/xterm.h7
3 files changed, 71 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 983ff107912..0234af5f1ef 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12012-12-30 Jan Djärv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (TOOLBAR_TOP_WIDGET): New macro.
4 (xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of
5 handlebox_widget. Set toolbar_in_hbox to false/true, set
6 toolbar_is_packed to true.
7 (xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET.
8 (update_frame_tool_bar): Check toolbar_is_packed for packing.
9 Show all on TOOLBAR_TOP_WIDGET.
10 (free_frame_tool_bar): Check toolbar_is_packed. Use widget returned
11 by TOOLBAR_TOP_WIDGET.
12 (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
13 Check toolbar_is_packed.
14
15 * xterm.h (struct x_output): Surround handlebox_widget with
16 #ifdef HAVE_GTK_HANDLE_BOX_NEW. toolbar_is_packed is new,
17 toolbar_in_hbox is bool.
18
12012-12-30 Andreas Schwab <schwab@linux-m68k.org> 192012-12-30 Andreas Schwab <schwab@linux-m68k.org>
2 20
3 * src/Makefile.in (TEMACS_LDFLAGS2): Remove. 21 * src/Makefile.in (TEMACS_LDFLAGS2): Remove.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 7f50b67d1e5..b957f1241b8 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4269,6 +4269,12 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
4269 gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) 4269 gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o)
4270#endif 4270#endif
4271 4271
4272#ifdef HAVE_GTK_HANDLE_BOX_NEW
4273#define TOOLBAR_TOP_WIDGET(x) ((x)->handlebox_widget)
4274#else
4275#define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget)
4276#endif
4277
4272/* Attach a tool bar to frame F. */ 4278/* Attach a tool bar to frame F. */
4273 4279
4274static void 4280static void
@@ -4276,14 +4282,16 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4276{ 4282{
4277 struct x_output *x = f->output_data.x; 4283 struct x_output *x = f->output_data.x;
4278 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); 4284 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
4285 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
4279 4286
4280 toolbar_set_orientation (x->toolbar_widget, 4287 toolbar_set_orientation (x->toolbar_widget,
4281 into_hbox 4288 into_hbox
4282 ? GTK_ORIENTATION_VERTICAL 4289 ? GTK_ORIENTATION_VERTICAL
4283 : GTK_ORIENTATION_HORIZONTAL); 4290 : GTK_ORIENTATION_HORIZONTAL);
4291#ifdef HAVE_GTK_HANDLE_BOX_NEW
4284 if (!x->handlebox_widget) 4292 if (!x->handlebox_widget)
4285 { 4293 {
4286 x->handlebox_widget = gtk_handle_box_new (); 4294 top_widget = x->handlebox_widget = gtk_handle_box_new ();
4287 g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", 4295 g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached",
4288 G_CALLBACK (xg_tool_bar_detach_callback), f); 4296 G_CALLBACK (xg_tool_bar_detach_callback), f);
4289 g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", 4297 g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached",
@@ -4291,34 +4299,40 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4291 gtk_container_add (GTK_CONTAINER (x->handlebox_widget), 4299 gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
4292 x->toolbar_widget); 4300 x->toolbar_widget);
4293 } 4301 }
4302#endif
4294 4303
4295 if (into_hbox) 4304 if (into_hbox)
4296 { 4305 {
4306#ifdef HAVE_GTK_HANDLE_BOX_NEW
4297 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), 4307 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
4298 GTK_POS_TOP); 4308 GTK_POS_TOP);
4299 gtk_box_pack_start (GTK_BOX (x->hbox_widget), x->handlebox_widget, 4309#endif
4310 gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget,
4300 FALSE, FALSE, 0); 4311 FALSE, FALSE, 0);
4301 4312
4302 if (EQ (pos, Qleft)) 4313 if (EQ (pos, Qleft))
4303 gtk_box_reorder_child (GTK_BOX (x->hbox_widget), 4314 gtk_box_reorder_child (GTK_BOX (x->hbox_widget),
4304 x->handlebox_widget, 4315 top_widget,
4305 0); 4316 0);
4306 x->toolbar_in_hbox = 1; 4317 x->toolbar_in_hbox = true;
4307 } 4318 }
4308 else 4319 else
4309 { 4320 {
4310 bool vbox_pos = x->menubar_widget != 0; 4321 bool vbox_pos = x->menubar_widget != 0;
4322#ifdef HAVE_GTK_HANDLE_BOX_NEW
4311 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), 4323 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
4312 GTK_POS_LEFT); 4324 GTK_POS_LEFT);
4313 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, 4325#endif
4326 gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget,
4314 FALSE, FALSE, 0); 4327 FALSE, FALSE, 0);
4315 4328
4316 if (EQ (pos, Qtop)) 4329 if (EQ (pos, Qtop))
4317 gtk_box_reorder_child (GTK_BOX (x->vbox_widget), 4330 gtk_box_reorder_child (GTK_BOX (x->vbox_widget),
4318 x->handlebox_widget, 4331 top_widget,
4319 vbox_pos); 4332 vbox_pos);
4320 x->toolbar_in_hbox = 0; 4333 x->toolbar_in_hbox = false;
4321 } 4334 }
4335 x->toolbar_is_packed = true;
4322} 4336}
4323 4337
4324/* Create a tool bar for frame F. */ 4338/* Create a tool bar for frame F. */
@@ -4561,13 +4575,14 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4561 struct x_output *x = f->output_data.x; 4575 struct x_output *x = f->output_data.x;
4562 GtkRequisition req; 4576 GtkRequisition req;
4563 int nl = 0, nr = 0, nt = 0, nb = 0; 4577 int nl = 0, nr = 0, nt = 0, nb = 0;
4578 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
4564 4579
4565 gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req); 4580 gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req);
4566 if (x->toolbar_in_hbox) 4581 if (x->toolbar_in_hbox)
4567 { 4582 {
4568 int pos; 4583 int pos;
4569 gtk_container_child_get (GTK_CONTAINER (x->hbox_widget), 4584 gtk_container_child_get (GTK_CONTAINER (x->hbox_widget),
4570 x->handlebox_widget, 4585 top_widget,
4571 "position", &pos, NULL); 4586 "position", &pos, NULL);
4572 if (pos == 0) nl = req.width; 4587 if (pos == 0) nl = req.width;
4573 else nr = req.width; 4588 else nr = req.width;
@@ -4576,7 +4591,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4576 { 4591 {
4577 int pos; 4592 int pos;
4578 gtk_container_child_get (GTK_CONTAINER (x->vbox_widget), 4593 gtk_container_child_get (GTK_CONTAINER (x->vbox_widget),
4579 x->handlebox_widget, 4594 top_widget,
4580 "position", &pos, NULL); 4595 "position", &pos, NULL);
4581 if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; 4596 if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height;
4582 else nb = req.height; 4597 else nb = req.height;
@@ -4611,7 +4626,6 @@ update_frame_tool_bar (FRAME_PTR f)
4611 GtkToolbar *wtoolbar; 4626 GtkToolbar *wtoolbar;
4612 GtkToolItem *ti; 4627 GtkToolItem *ti;
4613 GtkTextDirection dir; 4628 GtkTextDirection dir;
4614 bool pack_tool_bar = x->handlebox_widget == NULL;
4615 Lisp_Object style; 4629 Lisp_Object style;
4616 bool text_image, horiz; 4630 bool text_image, horiz;
4617 struct xg_frame_tb_info *tbinfo; 4631 struct xg_frame_tb_info *tbinfo;
@@ -4865,9 +4879,9 @@ update_frame_tool_bar (FRAME_PTR f)
4865 4879
4866 if (f->n_tool_bar_items != 0) 4880 if (f->n_tool_bar_items != 0)
4867 { 4881 {
4868 if (pack_tool_bar) 4882 if (! x->toolbar_is_packed)
4869 xg_pack_tool_bar (f, f->tool_bar_position); 4883 xg_pack_tool_bar (f, f->tool_bar_position);
4870 gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget)); 4884 gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x));
4871 if (xg_update_tool_bar_sizes (f)) 4885 if (xg_update_tool_bar_sizes (f))
4872 xg_height_or_width_changed (f); 4886 xg_height_or_width_changed (f);
4873 } 4887 }
@@ -4886,24 +4900,26 @@ free_frame_tool_bar (FRAME_PTR f)
4886 if (x->toolbar_widget) 4900 if (x->toolbar_widget)
4887 { 4901 {
4888 struct xg_frame_tb_info *tbinfo; 4902 struct xg_frame_tb_info *tbinfo;
4889 bool is_packed = x->handlebox_widget != 0; 4903 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
4904
4890 block_input (); 4905 block_input ();
4891 /* We may have created the toolbar_widget in xg_create_tool_bar, but 4906 /* We may have created the toolbar_widget in xg_create_tool_bar, but
4892 not the x->handlebox_widget which is created in xg_pack_tool_bar. */ 4907 not the x->handlebox_widget which is created in xg_pack_tool_bar. */
4893 if (is_packed) 4908 if (x->toolbar_is_packed)
4894 { 4909 {
4895 if (x->toolbar_in_hbox) 4910 if (x->toolbar_in_hbox)
4896 gtk_container_remove (GTK_CONTAINER (x->hbox_widget), 4911 gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
4897 x->handlebox_widget); 4912 top_widget);
4898 else 4913 else
4899 gtk_container_remove (GTK_CONTAINER (x->vbox_widget), 4914 gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
4900 x->handlebox_widget); 4915 top_widget);
4901 } 4916 }
4902 else 4917 else
4903 gtk_widget_destroy (x->toolbar_widget); 4918 gtk_widget_destroy (x->toolbar_widget);
4904 4919
4905 x->toolbar_widget = 0; 4920 x->toolbar_widget = 0;
4906 x->handlebox_widget = 0; 4921 TOOLBAR_TOP_WIDGET (x) = 0;
4922 x->toolbar_is_packed = false;
4907 FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; 4923 FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0;
4908 FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; 4924 FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0;
4909 4925
@@ -4927,20 +4943,25 @@ void
4927xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) 4943xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
4928{ 4944{
4929 struct x_output *x = f->output_data.x; 4945 struct x_output *x = f->output_data.x;
4946 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
4930 4947
4931 if (! x->toolbar_widget || ! x->handlebox_widget) 4948 if (! x->toolbar_widget || ! top_widget)
4932 return; 4949 return;
4933 4950
4934 block_input (); 4951 block_input ();
4935 g_object_ref (x->handlebox_widget); 4952 g_object_ref (top_widget);
4936 if (x->toolbar_in_hbox) 4953 if (x->toolbar_is_packed)
4937 gtk_container_remove (GTK_CONTAINER (x->hbox_widget), 4954 {
4938 x->handlebox_widget); 4955 if (x->toolbar_in_hbox)
4939 else 4956 gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
4940 gtk_container_remove (GTK_CONTAINER (x->vbox_widget), 4957 top_widget);
4941 x->handlebox_widget); 4958 else
4959 gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
4960 top_widget);
4961 }
4962
4942 xg_pack_tool_bar (f, pos); 4963 xg_pack_tool_bar (f, pos);
4943 g_object_unref (x->handlebox_widget); 4964 g_object_unref (top_widget);
4944 if (xg_update_tool_bar_sizes (f)) 4965 if (xg_update_tool_bar_sizes (f))
4945 xg_height_or_width_changed (f); 4966 xg_height_or_width_changed (f);
4946 4967
diff --git a/src/xterm.h b/src/xterm.h
index e680cbe7dd2..2d99d2f25db 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -473,10 +473,13 @@ struct x_output
473 GtkWidget *menubar_widget; 473 GtkWidget *menubar_widget;
474 /* The tool bar in this frame */ 474 /* The tool bar in this frame */
475 GtkWidget *toolbar_widget; 475 GtkWidget *toolbar_widget;
476 /* The handle box that makes the tool bar detachable. */ 476#ifdef HAVE_GTK_HANDLE_BOX_NEW
477/* The handle box that makes the tool bar detachable. */
477 GtkWidget *handlebox_widget; 478 GtkWidget *handlebox_widget;
479#endif
478 /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */ 480 /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */
479 int toolbar_in_hbox; 481 bool toolbar_in_hbox;
482 bool toolbar_is_packed;
480 483
481 /* The last size hints set. */ 484 /* The last size hints set. */
482 GdkGeometry size_hints; 485 GdkGeometry size_hints;