/
gdkx11window.go
235 lines (191 loc) · 7.41 KB
/
gdkx11window.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// Code generated by girgen. DO NOT EDIT.
package gdkx11
import (
"runtime"
"unsafe"
externglib "github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/diamondburned/gotk4/pkg/gdk/v3"
)
// #cgo pkg-config: gdk-x11-3.0 gtk+-3.0
// #cgo CFLAGS: -Wno-deprecated-declarations
// #include <gdk/gdkx.h>
// #include <glib-object.h>
import "C"
func init() {
externglib.RegisterGValueMarshalers([]externglib.TypeMarshaler{
{T: externglib.Type(C.gdk_x11_window_get_type()), F: marshalX11Windower},
})
}
// X11GetServerTime: routine to get the current X server time stamp.
func X11GetServerTime(window *X11Window) uint32 {
var _arg1 *C.GdkWindow // out
var _cret C.guint32 // in
_arg1 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_cret = C.gdk_x11_get_server_time(_arg1)
runtime.KeepAlive(window)
var _guint32 uint32 // out
_guint32 = uint32(_cret)
return _guint32
}
type X11Window struct {
gdk.Window
}
func wrapX11Window(obj *externglib.Object) *X11Window {
return &X11Window{
Window: gdk.Window{
Object: obj,
},
}
}
func marshalX11Windower(p uintptr) (interface{}, error) {
val := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
obj := externglib.Take(unsafe.Pointer(val))
return wrapX11Window(obj), nil
}
// Desktop gets the number of the workspace window is on.
func (window *X11Window) Desktop() uint32 {
var _arg0 *C.GdkWindow // out
var _cret C.guint32 // in
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_cret = C.gdk_x11_window_get_desktop(_arg0)
runtime.KeepAlive(window)
var _guint32 uint32 // out
_guint32 = uint32(_cret)
return _guint32
}
// MoveToCurrentDesktop moves the window to the correct workspace when running
// under a window manager that supports multiple workspaces, as described in the
// Extended Window Manager Hints (http://www.freedesktop.org/Standards/wm-spec)
// specification. Will not do anything if the window is already on all
// workspaces.
func (window *X11Window) MoveToCurrentDesktop() {
var _arg0 *C.GdkWindow // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
C.gdk_x11_window_move_to_current_desktop(_arg0)
runtime.KeepAlive(window)
}
// MoveToDesktop moves the window to the given workspace when running unde a
// window manager that supports multiple workspaces, as described in the
// Extended Window Manager Hints (http://www.freedesktop.org/Standards/wm-spec)
// specification.
func (window *X11Window) MoveToDesktop(desktop uint32) {
var _arg0 *C.GdkWindow // out
var _arg1 C.guint32 // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_arg1 = C.guint32(desktop)
C.gdk_x11_window_move_to_desktop(_arg0, _arg1)
runtime.KeepAlive(window)
runtime.KeepAlive(desktop)
}
// SetFrameExtents: this is the same as gdk_window_set_shadow_width() but it
// only works on GdkX11Window.
//
// Deprecated: Use gdk_window_set_shadow_width() instead.
func (window *X11Window) SetFrameExtents(left int, right int, top int, bottom int) {
var _arg0 *C.GdkWindow // out
var _arg1 C.int // out
var _arg2 C.int // out
var _arg3 C.int // out
var _arg4 C.int // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_arg1 = C.int(left)
_arg2 = C.int(right)
_arg3 = C.int(top)
_arg4 = C.int(bottom)
C.gdk_x11_window_set_frame_extents(_arg0, _arg1, _arg2, _arg3, _arg4)
runtime.KeepAlive(window)
runtime.KeepAlive(left)
runtime.KeepAlive(right)
runtime.KeepAlive(top)
runtime.KeepAlive(bottom)
}
// SetFrameSyncEnabled: this function can be used to disable frame
// synchronization for a window. Normally frame synchronziation will be enabled
// or disabled based on whether the system has a compositor that supports frame
// synchronization, but if the window is not directly managed by the window
// manager, then frame synchronziation may need to be disabled. This is the case
// for a window embedded via the XEMBED protocol.
func (window *X11Window) SetFrameSyncEnabled(frameSyncEnabled bool) {
var _arg0 *C.GdkWindow // out
var _arg1 C.gboolean // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
if frameSyncEnabled {
_arg1 = C.TRUE
}
C.gdk_x11_window_set_frame_sync_enabled(_arg0, _arg1)
runtime.KeepAlive(window)
runtime.KeepAlive(frameSyncEnabled)
}
// SetHideTitlebarWhenMaximized: set a hint for the window manager, requesting
// that the titlebar should be hidden when the window is maximized.
//
// Note that this property is automatically updated by GTK+, so this function
// should only be used by applications which do not use GTK+ to create toplevel
// windows.
func (window *X11Window) SetHideTitlebarWhenMaximized(hideTitlebarWhenMaximized bool) {
var _arg0 *C.GdkWindow // out
var _arg1 C.gboolean // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
if hideTitlebarWhenMaximized {
_arg1 = C.TRUE
}
C.gdk_x11_window_set_hide_titlebar_when_maximized(_arg0, _arg1)
runtime.KeepAlive(window)
runtime.KeepAlive(hideTitlebarWhenMaximized)
}
// SetThemeVariant: GTK+ applications can request a dark theme variant. In order
// to make other applications - namely window managers using GTK+ for themeing -
// aware of this choice, GTK+ uses this function to export the requested theme
// variant as _GTK_THEME_VARIANT property on toplevel windows.
//
// Note that this property is automatically updated by GTK+, so this function
// should only be used by applications which do not use GTK+ to create toplevel
// windows.
func (window *X11Window) SetThemeVariant(variant string) {
var _arg0 *C.GdkWindow // out
var _arg1 *C.char // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(variant)))
defer C.free(unsafe.Pointer(_arg1))
C.gdk_x11_window_set_theme_variant(_arg0, _arg1)
runtime.KeepAlive(window)
runtime.KeepAlive(variant)
}
// SetUserTime: application can use this call to update the _NET_WM_USER_TIME
// property on a toplevel window. This property stores an Xserver time which
// represents the time of the last user input event received for this window.
// This property may be used by the window manager to alter the focus, stacking,
// and/or placement behavior of windows when they are mapped depending on
// whether the new window was created by a user action or is a "pop-up" window
// activated by a timer or some other event.
//
// Note that this property is automatically updated by GDK, so this function
// should only be used by applications which handle input events bypassing GDK.
func (window *X11Window) SetUserTime(timestamp uint32) {
var _arg0 *C.GdkWindow // out
var _arg1 C.guint32 // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_arg1 = C.guint32(timestamp)
C.gdk_x11_window_set_user_time(_arg0, _arg1)
runtime.KeepAlive(window)
runtime.KeepAlive(timestamp)
}
// SetUTF8Property: this function modifies or removes an arbitrary X11 window
// property of type UTF8_STRING. If the given window is not a toplevel window,
// it is ignored.
func (window *X11Window) SetUTF8Property(name string, value string) {
var _arg0 *C.GdkWindow // out
var _arg1 *C.gchar // out
var _arg2 *C.gchar // out
_arg0 = (*C.GdkWindow)(unsafe.Pointer(window.Native()))
_arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name)))
defer C.free(unsafe.Pointer(_arg1))
if value != "" {
_arg2 = (*C.gchar)(unsafe.Pointer(C.CString(value)))
defer C.free(unsafe.Pointer(_arg2))
}
C.gdk_x11_window_set_utf8_property(_arg0, _arg1, _arg2)
runtime.KeepAlive(window)
runtime.KeepAlive(name)
runtime.KeepAlive(value)
}