annotate src/gui_gtk_f.c @ 33622:ff131131b561 v9.0.2053

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