Mercurial > vim
comparison src/gui_gtk_f.c @ 22665:dd711a44e75b v8.2.1881
patch 8.2.1881: cannot build with GTK3
Commit: https://github.com/vim/vim/commit/692d1a51e74fea2db3c7e9ae7c7c6c3a1a1945ee
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 21 17:28:27 2020 +0200
patch 8.2.1881: cannot build with GTK3
Problem: Cannot build with GTK3.
Solution: Adjust form functions.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Oct 2020 17:30:04 +0200 |
parents | 8623ab39b421 |
children | e5ee2ffd826a |
comparison
equal
deleted
inserted
replaced
22664:9ce47e3bca78 | 22665:dd711a44e75b |
---|---|
46 gint y; // relative subwidget y position | 46 gint y; // relative subwidget y position |
47 gint mapped; | 47 gint mapped; |
48 }; | 48 }; |
49 | 49 |
50 | 50 |
51 static void form_class_init(GtkFormClass *klass); | 51 static void gui_gtk_form_class_init(GtkFormClass *klass); |
52 static void form_init(GtkForm *form, void *g_class); | 52 #if GTK_CHECK_VERSION(3,0,0) |
53 static void gui_gtk_form_init(GtkForm *form); | |
54 #else | |
55 static void gui_gtk_form_init(GtkForm *form, void *g_class); | |
56 #endif | |
53 | 57 |
54 static void form_realize(GtkWidget *widget); | 58 static void form_realize(GtkWidget *widget); |
55 static void form_unrealize(GtkWidget *widget); | 59 static void form_unrealize(GtkWidget *widget); |
56 static void form_map(GtkWidget *widget); | 60 static void form_map(GtkWidget *widget); |
57 static void form_size_request(GtkWidget *widget, GtkRequisition *requisition); | 61 static void form_size_request(GtkWidget *widget, GtkRequisition *requisition); |
193 } | 197 } |
194 } | 198 } |
195 } | 199 } |
196 | 200 |
197 // Basic Object handling procedures | 201 // Basic Object handling procedures |
198 #if GTK_CHECK_VERSION(3,0,0) | 202 |
199 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) | 203 #if GTK_CHECK_VERSION(3,0,0) |
204 G_DEFINE_TYPE(GtkForm, gui_gtk_form, GTK_TYPE_CONTAINER) | |
200 #else | 205 #else |
201 GtkType | 206 GtkType |
202 gui_gtk_form_get_type(void) | 207 gui_gtk_form_get_type(void) |
203 { | 208 { |
204 static GtkType form_type = 0; | 209 static GtkType form_type = 0; |
209 | 214 |
210 CLEAR_FIELD(form_info); | 215 CLEAR_FIELD(form_info); |
211 form_info.type_name = "GtkForm"; | 216 form_info.type_name = "GtkForm"; |
212 form_info.object_size = sizeof(GtkForm); | 217 form_info.object_size = sizeof(GtkForm); |
213 form_info.class_size = sizeof(GtkFormClass); | 218 form_info.class_size = sizeof(GtkFormClass); |
214 form_info.class_init_func = (GtkClassInitFunc)form_class_init; | 219 form_info.class_init_func = (GtkClassInitFunc)gui_gtk_form_class_init; |
215 form_info.object_init_func = (GtkObjectInitFunc)form_init; | 220 form_info.object_init_func = (GtkObjectInitFunc)gui_gtk_form_init; |
216 | 221 |
217 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); | 222 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); |
218 } | 223 } |
219 return form_type; | 224 return form_type; |
220 } | 225 } |
221 #endif // !GTK_CHECK_VERSION(3,0,0) | 226 #endif // !GTK_CHECK_VERSION(3,0,0) |
222 | 227 |
223 static void | 228 static void |
224 form_class_init(GtkFormClass *klass) | 229 gui_gtk_form_class_init(GtkFormClass *klass) |
225 { | 230 { |
226 GtkWidgetClass *widget_class; | 231 GtkWidgetClass *widget_class; |
227 GtkContainerClass *container_class; | 232 GtkContainerClass *container_class; |
228 | 233 |
229 widget_class = (GtkWidgetClass *) klass; | 234 widget_class = (GtkWidgetClass *) klass; |
252 container_class->remove = form_remove; | 257 container_class->remove = form_remove; |
253 container_class->forall = form_forall; | 258 container_class->forall = form_forall; |
254 } | 259 } |
255 | 260 |
256 static void | 261 static void |
257 form_init(GtkForm *form, void *g_class UNUSED) | 262 gui_gtk_form_init(GtkForm *form |
263 #if !GTK_CHECK_VERSION(3,0,0) | |
264 , void *g_class UNUSED | |
265 #endif | |
266 ) | |
258 { | 267 { |
259 #if GTK_CHECK_VERSION(3,0,0) | 268 #if GTK_CHECK_VERSION(3,0,0) |
260 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); | 269 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); |
261 #endif | 270 #endif |
262 form->children = NULL; | 271 form->children = NULL; |
414 | 423 |
415 tmp_list = tmp_list->next; | 424 tmp_list = tmp_list->next; |
416 } | 425 } |
417 | 426 |
418 #if GTK_CHECK_VERSION(3,0,0) | 427 #if GTK_CHECK_VERSION(3,0,0) |
419 if (GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) | 428 if (GTK_WIDGET_CLASS (gui_gtk_form_parent_class)->unrealize) |
420 (* GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (widget); | 429 (* GTK_WIDGET_CLASS (gui_gtk_form_parent_class)->unrealize) (widget); |
421 #else | 430 #else |
422 if (GTK_WIDGET_CLASS (parent_class)->unrealize) | 431 if (GTK_WIDGET_CLASS (parent_class)->unrealize) |
423 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); | 432 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); |
424 #endif | 433 #endif |
425 } | 434 } |
553 | 562 |
554 gtk_form_render_background(formchild->widget, cr); | 563 gtk_form_render_background(formchild->widget, cr); |
555 } | 564 } |
556 } | 565 } |
557 | 566 |
558 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); | 567 return GTK_WIDGET_CLASS(gui_gtk_form_parent_class)->draw(widget, cr); |
559 } | 568 } |
560 #else // !GTK_CHECK_VERSION(3,0,0) | 569 #else // !GTK_CHECK_VERSION(3,0,0) |
561 static gint | 570 static gint |
562 form_expose(GtkWidget *widget, GdkEventExpose *event) | 571 form_expose(GtkWidget *widget, GdkEventExpose *event) |
563 { | 572 { |