Mercurial > vim
annotate src/gui_gtk_f.c @ 22659:8623ab39b421 v8.2.1878
patch 8.2.1878: GTK: error for redefining function
Commit: https://github.com/vim/vim/commit/8a99e66b4f7616d9b0b9cefe742f82f9122087d5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 21 16:10:21 2020 +0200
patch 8.2.1878: GTK: error for redefining function
Problem: GTK: error for redefining function. (Tony Mechelynck)
Solution: Remove "gtk_" prefix from local functions and prepend "gui_" to
global functions.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Oct 2020 16:15:04 +0200 |
parents | cf8f2fa2c22a |
children | dd711a44e75b |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
8218
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
66 | 11 * (C) 1998,1999 by Marcin Dalecki <martin@dalecki.de> |
7 | 12 * |
13 * Support for GTK+ 2 was added by: | |
14 * (C) 2002,2003 Jason Hildebrand <jason@peaceworks.ca> | |
15 * Daniel Elstner <daniel.elstner@gmx.net> | |
16 * | |
1207 | 17 * This is a special purpose container widget, which manages arbitrary |
18 * children at arbitrary positions width arbitrary sizes. This finally puts | |
19 * an end on our resize problems with which we where struggling for such a | |
20 * long time. | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
21 * |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
22 * Support for GTK+ 3 was added by: |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
23 * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> |
7 | 24 */ |
25 | |
26 #include "vim.h" | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
27 #include <gtk/gtk.h> // without this it compiles, but gives errors at |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
28 // runtime! |
7 | 29 #include "gui_gtk_f.h" |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
30 #if !GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
31 # include <gtk/gtksignal.h> |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
32 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
14786
diff
changeset
|
33 #ifdef MSWIN |
7 | 34 # include <gdk/gdkwin32.h> |
35 #else | |
36 # include <gdk/gdkx.h> | |
37 #endif | |
38 | |
39 typedef struct _GtkFormChild GtkFormChild; | |
40 | |
41 struct _GtkFormChild | |
42 { | |
43 GtkWidget *widget; | |
44 GdkWindow *window; | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
45 gint x; // relative subwidget x position |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
46 gint y; // relative subwidget y position |
7 | 47 gint mapped; |
48 }; | |
49 | |
50 | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
51 static void form_class_init(GtkFormClass *klass); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
52 static void form_init(GtkForm *form, void *g_class); |
7 | 53 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
54 static void form_realize(GtkWidget *widget); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
55 static void form_unrealize(GtkWidget *widget); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
56 static void form_map(GtkWidget *widget); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
57 static void form_size_request(GtkWidget *widget, GtkRequisition *requisition); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
58 #if GTK_CHECK_VERSION(3,0,0) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
59 static void form_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
60 static void form_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
61 #endif |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
62 static void form_size_allocate(GtkWidget *widget, GtkAllocation *allocation); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
63 #if GTK_CHECK_VERSION(3,0,0) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
64 static gboolean form_draw(GtkWidget *widget, cairo_t *cr); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
65 #else |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
66 static gint form_expose(GtkWidget *widget, GdkEventExpose *event); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
67 #endif |
7 | 68 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
69 static void form_remove(GtkContainer *container, GtkWidget *widget); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
70 static void form_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
7 | 71 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
72 static void form_attach_child_window(GtkForm *form, GtkFormChild *child); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
73 static void form_realize_child(GtkForm *form, GtkFormChild *child); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
74 static void form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
75 static void form_position_children(GtkForm *form); |
7 | 76 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
77 static void form_send_configure(GtkForm *form); |
7 | 78 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
79 static void form_child_map(GtkWidget *widget, gpointer user_data); |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
80 static void form_child_unmap(GtkWidget *widget, gpointer user_data); |
7 | 81 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
82 #if !GTK_CHECK_VERSION(3,0,0) |
7 | 83 static GtkWidgetClass *parent_class = NULL; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
84 #endif |
7 | 85 |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
86 // Public interface |
7 | 87 |
88 GtkWidget * | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
89 gui_gtk_form_new(void) |
7 | 90 { |
91 GtkForm *form; | |
92 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
93 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
94 form = g_object_new(GTK_TYPE_FORM, NULL); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
95 #else |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
96 form = gtk_type_new(gui_gtk_form_get_type()); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
97 #endif |
7 | 98 |
99 return GTK_WIDGET(form); | |
100 } | |
101 | |
102 void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
103 gui_gtk_form_put( |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
104 GtkForm *form, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
105 GtkWidget *child_widget, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
106 gint x, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
107 gint y) |
7 | 108 { |
109 GtkFormChild *child; | |
110 | |
111 g_return_if_fail(GTK_IS_FORM(form)); | |
112 | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
113 // LINTED: avoid warning: conversion to 'unsigned long' |
7 | 114 child = g_new(GtkFormChild, 1); |
16429
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
15967
diff
changeset
|
115 if (child == NULL) |
a1229400434a
patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents:
15967
diff
changeset
|
116 return; |
7 | 117 |
118 child->widget = child_widget; | |
119 child->window = NULL; | |
120 child->x = x; | |
121 child->y = y; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
122 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
123 gtk_widget_set_size_request(child->widget, -1, -1); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
124 #else |
7 | 125 child->widget->requisition.width = 0; |
126 child->widget->requisition.height = 0; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
127 #endif |
7 | 128 child->mapped = FALSE; |
129 | |
130 form->children = g_list_append(form->children, child); | |
131 | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
132 // child->window must be created and attached to the widget _before_ |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
133 // it has been realized, or else things will break with GTK2. Note |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
134 // that gtk_widget_set_parent() realizes the widget if it's visible |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
135 // and its parent is mapped. |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
136 if (gtk_widget_get_realized(GTK_WIDGET(form))) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
137 form_attach_child_window(form, child); |
7 | 138 |
139 gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); | |
140 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
141 if (gtk_widget_get_realized(GTK_WIDGET(form)) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
142 && !gtk_widget_get_realized(child_widget)) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
143 form_realize_child(form, child); |
7 | 144 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
145 form_position_child(form, child, TRUE); |
7 | 146 } |
147 | |
148 void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
149 gui_gtk_form_move( |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
150 GtkForm *form, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
151 GtkWidget *child_widget, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
152 gint x, |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
153 gint y) |
7 | 154 { |
155 GList *tmp_list; | |
156 GtkFormChild *child; | |
157 | |
158 g_return_if_fail(GTK_IS_FORM(form)); | |
159 | |
160 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | |
161 { | |
162 child = tmp_list->data; | |
163 if (child->widget == child_widget) | |
164 { | |
165 child->x = x; | |
166 child->y = y; | |
167 | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
168 form_position_child(form, child, TRUE); |
7 | 169 return; |
170 } | |
171 } | |
172 } | |
173 | |
174 void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
175 gui_gtk_form_freeze(GtkForm *form) |
7 | 176 { |
177 g_return_if_fail(GTK_IS_FORM(form)); | |
178 | |
179 ++form->freeze_count; | |
180 } | |
181 | |
182 void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
183 gui_gtk_form_thaw(GtkForm *form) |
7 | 184 { |
185 g_return_if_fail(GTK_IS_FORM(form)); | |
186 | |
187 if (form->freeze_count) | |
188 { | |
189 if (!(--form->freeze_count)) | |
190 { | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
191 form_position_children(form); |
7 | 192 gtk_widget_queue_draw(GTK_WIDGET(form)); |
193 } | |
194 } | |
195 } | |
196 | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
197 // Basic Object handling procedures |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
198 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
199 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
200 #else |
7 | 201 GtkType |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
202 gui_gtk_form_get_type(void) |
7 | 203 { |
204 static GtkType form_type = 0; | |
205 | |
206 if (!form_type) | |
207 { | |
1884 | 208 GtkTypeInfo form_info; |
209 | |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
18781
diff
changeset
|
210 CLEAR_FIELD(form_info); |
1884 | 211 form_info.type_name = "GtkForm"; |
212 form_info.object_size = sizeof(GtkForm); | |
213 form_info.class_size = sizeof(GtkFormClass); | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
214 form_info.class_init_func = (GtkClassInitFunc)form_class_init; |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
215 form_info.object_init_func = (GtkObjectInitFunc)form_init; |
7 | 216 |
217 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); | |
218 } | |
219 return form_type; | |
220 } | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
221 #endif // !GTK_CHECK_VERSION(3,0,0) |
7 | 222 |
223 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
224 form_class_init(GtkFormClass *klass) |
7 | 225 { |
226 GtkWidgetClass *widget_class; | |
227 GtkContainerClass *container_class; | |
228 | |
229 widget_class = (GtkWidgetClass *) klass; | |
230 container_class = (GtkContainerClass *) klass; | |
231 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
232 #if !GTK_CHECK_VERSION(3,0,0) |
7 | 233 parent_class = gtk_type_class(gtk_container_get_type()); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
234 #endif |
7 | 235 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
236 widget_class->realize = form_realize; |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
237 widget_class->unrealize = form_unrealize; |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
238 widget_class->map = form_map; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
239 #if GTK_CHECK_VERSION(3,0,0) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
240 widget_class->get_preferred_width = form_get_preferred_width; |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
241 widget_class->get_preferred_height = form_get_preferred_height; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
242 #else |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
243 widget_class->size_request = form_size_request; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
244 #endif |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
245 widget_class->size_allocate = form_size_allocate; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
246 #if GTK_CHECK_VERSION(3,0,0) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
247 widget_class->draw = form_draw; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
248 #else |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
249 widget_class->expose_event = form_expose; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
250 #endif |
7 | 251 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
252 container_class->remove = form_remove; |
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
253 container_class->forall = form_forall; |
7 | 254 } |
255 | |
256 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
257 form_init(GtkForm *form, void *g_class UNUSED) |
7 | 258 { |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
259 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
260 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
261 #endif |
7 | 262 form->children = NULL; |
263 form->bin_window = NULL; | |
264 form->freeze_count = 0; | |
265 } | |
266 | |
267 /* | |
268 * Widget methods | |
269 */ | |
270 | |
271 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
272 form_realize(GtkWidget *widget) |
7 | 273 { |
274 GList *tmp_list; | |
275 GtkForm *form; | |
276 GdkWindowAttr attributes; | |
277 gint attributes_mask; | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
278 GtkAllocation allocation; |
7 | 279 |
280 g_return_if_fail(GTK_IS_FORM(widget)); | |
281 | |
282 form = GTK_FORM(widget); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
283 gtk_widget_set_realized(widget, TRUE); |
7 | 284 |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
285 gtk_widget_get_allocation(widget, &allocation); |
7 | 286 attributes.window_type = GDK_WINDOW_CHILD; |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
287 attributes.x = allocation.x; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
288 attributes.y = allocation.y; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
289 attributes.width = allocation.width; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
290 attributes.height = allocation.height; |
7 | 291 attributes.wclass = GDK_INPUT_OUTPUT; |
292 attributes.visual = gtk_widget_get_visual(widget); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
293 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
294 attributes.event_mask = GDK_EXPOSURE_MASK; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
295 #else |
7 | 296 attributes.colormap = gtk_widget_get_colormap(widget); |
297 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
298 #endif |
7 | 299 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
300 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
301 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
302 #else |
7 | 303 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
304 #endif |
7 | 305 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
306 gtk_widget_set_window(widget, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
307 gdk_window_new(gtk_widget_get_parent_window(widget), |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
308 &attributes, attributes_mask)); |
14712
82e7ce311065
patch 8.1.0368: GTK code has too many #ifdefs and GTK 2.10 building fails
Christian Brabandt <cb@256bit.org>
parents:
11343
diff
changeset
|
309 gdk_window_set_user_data(gtk_widget_get_window(widget), widget); |
7 | 310 |
311 attributes.x = 0; | |
312 attributes.y = 0; | |
313 attributes.event_mask = gtk_widget_get_events(widget); | |
314 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
315 form->bin_window = gdk_window_new(gtk_widget_get_window(widget), |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
316 &attributes, attributes_mask); |
7 | 317 gdk_window_set_user_data(form->bin_window, widget); |
318 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
319 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
320 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
321 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
322 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
323 gtk_style_context_add_class(sctx, "gtk-form"); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
324 gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
325 # if !GTK_CHECK_VERSION(3,18,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
326 gtk_style_context_set_background(sctx, gtk_widget_get_window(widget)); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
327 gtk_style_context_set_background(sctx, form->bin_window); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
328 # endif |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
329 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
330 #else |
7 | 331 widget->style = gtk_style_attach(widget->style, widget->window); |
332 gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); | |
333 gtk_style_set_background(widget->style, form->bin_window, GTK_STATE_NORMAL); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
334 #endif |
7 | 335 |
336 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | |
337 { | |
338 GtkFormChild *child = tmp_list->data; | |
339 | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
340 form_attach_child_window(form, child); |
7 | 341 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
342 if (gtk_widget_get_visible(child->widget)) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
343 form_realize_child(form, child); |
7 | 344 } |
345 } | |
346 | |
347 | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
348 // After reading the documentation at |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
349 // http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
350 // I think it should be possible to remove this function when compiling |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
351 // against gtk-2.0. It doesn't seem to cause problems, though. |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
352 // |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
353 // Well, I reckon at least the gdk_window_show(form->bin_window) |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
354 // is necessary. GtkForm is anything but a usual container widget. |
7 | 355 static void |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
356 form_map(GtkWidget *widget) |
7 | 357 { |
358 GList *tmp_list; | |
359 GtkForm *form; | |
360 | |
361 g_return_if_fail(GTK_IS_FORM(widget)); | |
362 | |
363 form = GTK_FORM(widget); | |
364 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
365 gtk_widget_set_mapped(widget, TRUE); |
7 | 366 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
367 gdk_window_show(gtk_widget_get_window(widget)); |
7 | 368 gdk_window_show(form->bin_window); |
369 | |
370 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | |
371 { | |
372 GtkFormChild *child = tmp_list->data; | |
373 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
374 if (gtk_widget_get_visible(child->widget) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
375 && !gtk_widget_get_mapped(child->widget)) |
7 | 376 gtk_widget_map(child->widget); |
377 } | |
378 } | |
379 | |
380 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
381 form_unrealize(GtkWidget *widget) |
7 | 382 { |
383 GList *tmp_list; | |
384 GtkForm *form; | |
385 | |
386 g_return_if_fail(GTK_IS_FORM(widget)); | |
387 | |
388 form = GTK_FORM(widget); | |
389 | |
390 tmp_list = form->children; | |
391 | |
392 gdk_window_set_user_data(form->bin_window, NULL); | |
393 gdk_window_destroy(form->bin_window); | |
394 form->bin_window = NULL; | |
395 | |
396 while (tmp_list) | |
397 { | |
398 GtkFormChild *child = tmp_list->data; | |
399 | |
400 if (child->window != NULL) | |
401 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
402 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
403 FUNC2GENERIC(form_child_map), |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
404 child); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
405 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
406 FUNC2GENERIC(form_child_unmap), |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
407 child); |
7 | 408 |
409 gdk_window_set_user_data(child->window, NULL); | |
410 gdk_window_destroy(child->window); | |
411 | |
412 child->window = NULL; | |
413 } | |
414 | |
415 tmp_list = tmp_list->next; | |
416 } | |
417 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
418 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
419 if (GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
420 (* GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (widget); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
421 #else |
7 | 422 if (GTK_WIDGET_CLASS (parent_class)->unrealize) |
423 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
424 #endif |
7 | 425 } |
426 | |
427 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
428 form_size_request(GtkWidget *widget, GtkRequisition *requisition) |
7 | 429 { |
11271
cd8dbed175a1
patch 8.0.0521: GtkForm handling is outdated
Christian Brabandt <cb@256bit.org>
parents:
10176
diff
changeset
|
430 g_return_if_fail(GTK_IS_FORM(widget)); |
cd8dbed175a1
patch 8.0.0521: GtkForm handling is outdated
Christian Brabandt <cb@256bit.org>
parents:
10176
diff
changeset
|
431 g_return_if_fail(requisition != NULL); |
7 | 432 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
433 requisition->width = 1; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
434 requisition->height = 1; |
7 | 435 } |
436 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
437 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
438 static void |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
439 form_get_preferred_width(GtkWidget *widget, |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
440 gint *minimal_width, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
441 gint *natural_width) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
442 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
443 GtkRequisition requisition; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
444 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
445 form_size_request(widget, &requisition); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
446 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
447 *minimal_width = requisition.width; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
448 *natural_width = requisition.width; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
449 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
450 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
451 static void |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
452 form_get_preferred_height(GtkWidget *widget, |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
453 gint *minimal_height, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
454 gint *natural_height) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
455 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
456 GtkRequisition requisition; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
457 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
458 form_size_request(widget, &requisition); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
459 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
460 *minimal_height = requisition.height; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
461 *natural_height = requisition.height; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
462 } |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
463 #endif // GTK_CHECK_VERSION(3,0,0) |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
464 |
7 | 465 static void |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
466 form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) |
7 | 467 { |
468 GList *tmp_list; | |
469 GtkForm *form; | |
470 gboolean need_reposition; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
471 GtkAllocation cur_alloc; |
7 | 472 |
473 g_return_if_fail(GTK_IS_FORM(widget)); | |
474 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
475 gtk_widget_get_allocation(widget, &cur_alloc); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
476 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
477 if (cur_alloc.x == allocation->x |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
478 && cur_alloc.y == allocation->y |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
479 && cur_alloc.width == allocation->width |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
480 && cur_alloc.height == allocation->height) |
7 | 481 return; |
482 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
483 need_reposition = cur_alloc.width != allocation->width |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
484 || cur_alloc.height != allocation->height; |
7 | 485 form = GTK_FORM(widget); |
486 | |
487 if (need_reposition) | |
488 { | |
489 tmp_list = form->children; | |
490 | |
491 while (tmp_list) | |
492 { | |
493 GtkFormChild *child = tmp_list->data; | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
494 form_position_child(form, child, TRUE); |
7 | 495 |
496 tmp_list = tmp_list->next; | |
497 } | |
498 } | |
499 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
500 if (gtk_widget_get_realized(widget)) |
7 | 501 { |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
502 gdk_window_move_resize(gtk_widget_get_window(widget), |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
503 allocation->x, allocation->y, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
504 allocation->width, allocation->height); |
7 | 505 gdk_window_move_resize(GTK_FORM(widget)->bin_window, |
506 0, 0, | |
507 allocation->width, allocation->height); | |
508 } | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
509 gtk_widget_set_allocation(widget, allocation); |
7 | 510 if (need_reposition) |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
511 form_send_configure(form); |
7 | 512 } |
513 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
514 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
515 static void |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
516 gtk_form_render_background(GtkWidget *widget, cairo_t *cr) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
517 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
518 gtk_render_background(gtk_widget_get_style_context(widget), cr, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
519 0, 0, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
520 gtk_widget_get_allocated_width(widget), |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
521 gtk_widget_get_allocated_height(widget)); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
522 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
523 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
524 static gboolean |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
525 form_draw(GtkWidget *widget, cairo_t *cr) |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
526 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
527 GList *tmp_list = NULL; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
528 GtkForm *form = NULL; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
529 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
530 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
531 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
532 gtk_form_render_background(widget, cr); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
533 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
534 form = GTK_FORM(widget); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
535 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
536 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
537 GtkFormChild * const formchild = tmp_list->data; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
538 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
539 if (!gtk_widget_get_has_window(formchild->widget) && |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
540 gtk_cairo_should_draw_window(cr, formchild->window)) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
541 { |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
542 // To get gtk_widget_draw() to work, it is required to call |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
543 // gtk_widget_size_allocate() in advance with a well-posed |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
544 // allocation for a given child widget in order to set a |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
545 // certain private GtkWidget variable, called |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
546 // widget->priv->alloc_need, to the proper value; otherwise, |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
547 // gtk_widget_draw() fails and the relevant scrollbar won't |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
548 // appear on the screen. |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
549 // |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
550 // Calling form_position_child() like this is one of ways |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
551 // to make sure of that. |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
552 form_position_child(form, formchild, TRUE); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
553 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
554 gtk_form_render_background(formchild->widget, cr); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
555 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
556 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
557 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
558 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
559 } |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
560 #else // !GTK_CHECK_VERSION(3,0,0) |
7 | 561 static gint |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
562 form_expose(GtkWidget *widget, GdkEventExpose *event) |
7 | 563 { |
564 GList *tmp_list; | |
565 GtkForm *form; | |
566 | |
567 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); | |
568 | |
569 form = GTK_FORM(widget); | |
570 | |
571 if (event->window == form->bin_window) | |
572 return FALSE; | |
573 | |
574 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | |
11271
cd8dbed175a1
patch 8.0.0521: GtkForm handling is outdated
Christian Brabandt <cb@256bit.org>
parents:
10176
diff
changeset
|
575 gtk_container_propagate_expose(GTK_CONTAINER(widget), |
cd8dbed175a1
patch 8.0.0521: GtkForm handling is outdated
Christian Brabandt <cb@256bit.org>
parents:
10176
diff
changeset
|
576 GTK_WIDGET(((GtkFormChild *)tmp_list->data)->widget), |
cd8dbed175a1
patch 8.0.0521: GtkForm handling is outdated
Christian Brabandt <cb@256bit.org>
parents:
10176
diff
changeset
|
577 event); |
7 | 578 |
579 return FALSE; | |
580 } | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
581 #endif // !GTK_CHECK_VERSION(3,0,0) |
7 | 582 |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
583 // Container method |
7 | 584 static void |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
585 form_remove(GtkContainer *container, GtkWidget *widget) |
7 | 586 { |
587 GList *tmp_list; | |
588 GtkForm *form; | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
589 GtkFormChild *child = NULL; // init for gcc |
7 | 590 |
591 g_return_if_fail(GTK_IS_FORM(container)); | |
592 | |
593 form = GTK_FORM(container); | |
594 | |
595 tmp_list = form->children; | |
596 while (tmp_list) | |
597 { | |
598 child = tmp_list->data; | |
599 if (child->widget == widget) | |
600 break; | |
601 tmp_list = tmp_list->next; | |
602 } | |
603 | |
604 if (tmp_list) | |
605 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
606 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
607 const gboolean was_visible = gtk_widget_get_visible(widget); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
608 #endif |
7 | 609 if (child->window) |
610 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
611 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
612 FUNC2GENERIC(&form_child_map), child); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
613 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
614 FUNC2GENERIC(&form_child_unmap), child); |
7 | 615 |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
616 // FIXME: This will cause problems for reparenting NO_WINDOW |
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
617 // widgets out of a GtkForm |
7 | 618 gdk_window_set_user_data(child->window, NULL); |
619 gdk_window_destroy(child->window); | |
620 } | |
621 gtk_widget_unparent(widget); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
622 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
623 if (was_visible) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
624 gtk_widget_queue_resize(GTK_WIDGET(container)); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
625 #endif |
7 | 626 form->children = g_list_remove_link(form->children, tmp_list); |
627 g_list_free_1(tmp_list); | |
628 g_free(child); | |
629 } | |
630 } | |
631 | |
632 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
633 form_forall(GtkContainer *container, |
1884 | 634 gboolean include_internals UNUSED, |
7 | 635 GtkCallback callback, |
636 gpointer callback_data) | |
637 { | |
638 GtkForm *form; | |
639 GtkFormChild *child; | |
640 GList *tmp_list; | |
641 | |
642 g_return_if_fail(GTK_IS_FORM(container)); | |
643 g_return_if_fail(callback != NULL); | |
644 | |
645 form = GTK_FORM(container); | |
646 | |
647 tmp_list = form->children; | |
648 while (tmp_list) | |
649 { | |
650 child = tmp_list->data; | |
651 tmp_list = tmp_list->next; | |
652 | |
653 (*callback) (child->widget, callback_data); | |
654 } | |
655 } | |
656 | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
657 // Operations on children |
7 | 658 |
659 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
660 form_attach_child_window(GtkForm *form, GtkFormChild *child) |
7 | 661 { |
662 if (child->window != NULL) | |
18781
79e10adc821d
patch 8.1.2380: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
16429
diff
changeset
|
663 return; // been there, done that |
7 | 664 |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
665 if (!gtk_widget_get_has_window(child->widget)) |
7 | 666 { |
667 GtkWidget *widget; | |
668 GdkWindowAttr attributes; | |
669 gint attributes_mask; | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
670 GtkRequisition requisition; |
7 | 671 |
672 widget = GTK_WIDGET(form); | |
673 | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
674 #if GTK_CHECK_VERSION(3,0,0) |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
675 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
676 #else |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
677 requisition = child->widget->requisition; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
678 #endif |
7 | 679 attributes.window_type = GDK_WINDOW_CHILD; |
680 attributes.x = child->x; | |
681 attributes.y = child->y; | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
682 attributes.width = requisition.width; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
683 attributes.height = requisition.height; |
7 | 684 attributes.wclass = GDK_INPUT_OUTPUT; |
685 attributes.visual = gtk_widget_get_visual(widget); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
686 #if !GTK_CHECK_VERSION(3,0,0) |
7 | 687 attributes.colormap = gtk_widget_get_colormap(widget); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
688 #endif |
7 | 689 attributes.event_mask = GDK_EXPOSURE_MASK; |
690 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
691 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
692 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
693 #else |
7 | 694 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
695 #endif |
7 | 696 child->window = gdk_window_new(form->bin_window, |
697 &attributes, attributes_mask); | |
698 gdk_window_set_user_data(child->window, widget); | |
699 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
700 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
701 { |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
702 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
703 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
704 gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
705 # if !GTK_CHECK_VERSION(3,18,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
706 gtk_style_context_set_background(sctx, child->window); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
707 # endif |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
708 } |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
709 #else |
7 | 710 gtk_style_set_background(widget->style, |
711 child->window, | |
712 GTK_STATE_NORMAL); | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
713 #endif |
7 | 714 |
715 gtk_widget_set_parent_window(child->widget, child->window); | |
716 /* | |
717 * Install signal handlers to map/unmap child->window | |
718 * alongside with the actual widget. | |
719 */ | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
720 g_signal_connect(G_OBJECT(child->widget), "map", |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
721 G_CALLBACK(&form_child_map), child); |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
722 g_signal_connect(G_OBJECT(child->widget), "unmap", |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
723 G_CALLBACK(&form_child_unmap), child); |
7 | 724 } |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
725 else if (!gtk_widget_get_realized(child->widget)) |
7 | 726 { |
727 gtk_widget_set_parent_window(child->widget, form->bin_window); | |
728 } | |
729 } | |
730 | |
731 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
732 form_realize_child(GtkForm *form, GtkFormChild *child) |
7 | 733 { |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
734 form_attach_child_window(form, child); |
7 | 735 gtk_widget_realize(child->widget); |
736 } | |
737 | |
738 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
739 form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate) |
7 | 740 { |
741 gint x; | |
742 gint y; | |
743 | |
744 x = child->x; | |
745 y = child->y; | |
746 | |
747 if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && | |
748 (y >= G_MINSHORT) && (y <= G_MAXSHORT)) | |
749 { | |
750 if (!child->mapped) | |
751 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
752 if (gtk_widget_get_mapped(GTK_WIDGET(form)) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
753 && gtk_widget_get_visible(child->widget)) |
7 | 754 { |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
755 if (!gtk_widget_get_mapped(child->widget)) |
7 | 756 gtk_widget_map(child->widget); |
757 | |
758 child->mapped = TRUE; | |
759 force_allocate = TRUE; | |
760 } | |
761 } | |
762 | |
763 if (force_allocate) | |
764 { | |
765 GtkAllocation allocation; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
766 GtkRequisition requisition; |
7 | 767 |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
768 #if GTK_CHECK_VERSION(3,0,0) |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
769 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
770 #else |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
771 requisition = child->widget->requisition; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
772 #endif |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
773 |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
774 if (!gtk_widget_get_has_window(child->widget)) |
7 | 775 { |
776 if (child->window) | |
777 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
778 gdk_window_move_resize(child->window, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
779 x, y, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
780 requisition.width, |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
781 requisition.height); |
7 | 782 } |
783 | |
784 allocation.x = 0; | |
785 allocation.y = 0; | |
786 } | |
787 else | |
788 { | |
789 allocation.x = x; | |
790 allocation.y = y; | |
791 } | |
792 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
793 allocation.width = requisition.width; |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
794 allocation.height = requisition.height; |
7 | 795 |
796 gtk_widget_size_allocate(child->widget, &allocation); | |
797 } | |
798 } | |
799 else | |
800 { | |
801 if (child->mapped) | |
802 { | |
803 child->mapped = FALSE; | |
804 | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
805 if (gtk_widget_get_mapped(child->widget)) |
7 | 806 gtk_widget_unmap(child->widget); |
807 } | |
808 } | |
809 } | |
810 | |
811 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
812 form_position_children(GtkForm *form) |
7 | 813 { |
814 GList *tmp_list; | |
815 | |
816 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
817 form_position_child(form, tmp_list->data, FALSE); |
7 | 818 } |
819 | |
820 void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
821 gui_gtk_form_move_resize(GtkForm *form, GtkWidget *widget, |
7 | 822 gint x, gint y, gint w, gint h) |
823 { | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
824 #if GTK_CHECK_VERSION(3,0,0) |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
825 gtk_widget_set_size_request(widget, w, h); |
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
826 #else |
7 | 827 widget->requisition.width = w; |
828 widget->requisition.height = h; | |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
829 #endif |
7 | 830 |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
831 gui_gtk_form_move(form, widget, x, y); |
7 | 832 } |
833 | |
834 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
835 form_send_configure(GtkForm *form) |
7 | 836 { |
837 GtkWidget *widget; | |
838 GdkEventConfigure event; | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
839 GtkAllocation allocation; |
7 | 840 |
841 widget = GTK_WIDGET(form); | |
842 | |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
843 gtk_widget_get_allocation(widget, &allocation); |
7 | 844 event.type = GDK_CONFIGURE; |
8218
3456e2ebebd4
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Christian Brabandt <cb@256bit.org>
parents:
2275
diff
changeset
|
845 event.window = gtk_widget_get_window(widget); |
14786
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
846 event.x = allocation.x; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
847 event.y = allocation.y; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
848 event.width = allocation.width; |
11978f68a8c3
patch 8.1.0405: too many #ifdefs for GTK
Christian Brabandt <cb@256bit.org>
parents:
14712
diff
changeset
|
849 event.height = allocation.height; |
7 | 850 |
851 gtk_main_do_event((GdkEvent*)&event); | |
852 } | |
853 | |
854 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
855 form_child_map(GtkWidget *widget UNUSED, gpointer user_data) |
7 | 856 { |
857 GtkFormChild *child; | |
858 | |
859 child = (GtkFormChild *)user_data; | |
860 | |
861 child->mapped = TRUE; | |
862 gdk_window_show(child->window); | |
863 } | |
864 | |
865 static void | |
22659
8623ab39b421
patch 8.2.1878: GTK: error for redefining function
Bram Moolenaar <Bram@vim.org>
parents:
22653
diff
changeset
|
866 form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data) |
7 | 867 { |
868 GtkFormChild *child; | |
869 | |
870 child = (GtkFormChild *)user_data; | |
871 | |
872 child->mapped = FALSE; | |
873 gdk_window_hide(child->window); | |
874 } |