File: | cafe-panel/panel-toplevel.c |
Warning: | line 2422, column 9 Assigned value is garbage or undefined |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- | |||
2 | * | |||
3 | * panel-toplevel.c: The panel's toplevel window object. | |||
4 | * | |||
5 | * Copyright (C) 2003 Sun Microsystems, Inc. | |||
6 | * Copyright (C) 2004 Rob Adams | |||
7 | * | |||
8 | * This program is free software; you can redistribute it and/or | |||
9 | * modify it under the terms of the GNU General Public License as | |||
10 | * published by the Free Software Foundation; either version 2 of the | |||
11 | * License, or (at your option) any later version. | |||
12 | * | |||
13 | * This program is distributed in the hope that it will be useful, but | |||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
16 | * General Public License for more details. | |||
17 | * | |||
18 | * You should have received a copy of the GNU General Public License | |||
19 | * along with this program; if not, write to the Free Software | |||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |||
21 | * 02110-1301, USA. | |||
22 | * | |||
23 | * Authors: | |||
24 | * Mark McLoughlin <mark@skynet.ie> | |||
25 | */ | |||
26 | ||||
27 | #include <config.h> | |||
28 | ||||
29 | #include "panel-toplevel.h" | |||
30 | ||||
31 | #include <stdlib.h> | |||
32 | #include <string.h> | |||
33 | ||||
34 | #include <ctk/ctk.h> | |||
35 | #include <cdk/cdkkeysyms.h> | |||
36 | #include <glib/gi18n.h> | |||
37 | ||||
38 | #ifdef HAVE_X111 | |||
39 | #include <cdk/cdkx.h> | |||
40 | #endif | |||
41 | ||||
42 | #include "panel-util.h" | |||
43 | #include "panel-profile.h" | |||
44 | #include "panel-frame.h" | |||
45 | #include "panel-multimonitor.h" | |||
46 | #include "panel-a11y.h" | |||
47 | #include "panel-typebuiltins.h" | |||
48 | #include "panel-marshal.h" | |||
49 | #include "panel-widget.h" | |||
50 | #include "panel-bindings.h" | |||
51 | #include "panel-config-global.h" | |||
52 | #include "panel-lockdown.h" | |||
53 | #include "panel-schemas.h" | |||
54 | ||||
55 | #ifdef HAVE_X111 | |||
56 | #include "xstuff.h" | |||
57 | #include "panel-xutils.h" | |||
58 | #include "panel-struts.h" | |||
59 | #endif | |||
60 | #ifdef HAVE_WAYLAND | |||
61 | #include "wayland-backend.h" | |||
62 | #endif | |||
63 | ||||
64 | #define DEFAULT_SIZE48 48 | |||
65 | #define DEFAULT_AUTO_HIDE_SIZE1 1 | |||
66 | #define DEFAULT_HIDE_DELAY300 300 | |||
67 | #define DEFAULT_UNHIDE_DELAY100 100 | |||
68 | #define DEFAULT_DND_THRESHOLD8 8 | |||
69 | #define MINIMUM_WIDTH100 100 | |||
70 | #define MAXIMUM_SIZE_SCREEN_RATIO5 5 | |||
71 | #define SNAP_TOLERANCE_FACTOR6 6 | |||
72 | #define DEFAULT_ARROW_SIZE20 20 | |||
73 | #define HANDLE_SIZE10 10 | |||
74 | #define N_ATTACH_TOPLEVEL_SIGNALS5 5 | |||
75 | #define N_ATTACH_WIDGET_SIGNALS5 5 | |||
76 | ||||
77 | typedef enum { | |||
78 | PANEL_GRAB_OP_NONE, | |||
79 | PANEL_GRAB_OP_MOVE, | |||
80 | PANEL_GRAB_OP_RESIZE, | |||
81 | PANEL_GRAB_OP_RESIZE_UP, | |||
82 | PANEL_GRAB_OP_RESIZE_DOWN, | |||
83 | PANEL_GRAB_OP_RESIZE_LEFT, | |||
84 | PANEL_GRAB_OP_RESIZE_RIGHT | |||
85 | } PanelGrabOpType; | |||
86 | ||||
87 | struct _PanelToplevelPrivate { | |||
88 | gchar *settings_path; | |||
89 | ||||
90 | gboolean expand; | |||
91 | PanelOrientation orientation; | |||
92 | int size; | |||
93 | gint scale; | |||
94 | ||||
95 | /* relative to the monitor origin */ | |||
96 | int x; | |||
97 | int y; | |||
98 | /* relative to the bottom right corner, -1 to ignore and use x, y*/ | |||
99 | int x_right; | |||
100 | int y_bottom; | |||
101 | ||||
102 | int monitor; | |||
103 | /* this is used when the configured monitor is missing. We keep it so | |||
104 | * we can move the toplevel to the right monitor when it becomes | |||
105 | * available */ | |||
106 | int configured_monitor; | |||
107 | ||||
108 | int hide_delay; | |||
109 | int unhide_delay; | |||
110 | int auto_hide_size; | |||
111 | PanelAnimationSpeed animation_speed; | |||
112 | ||||
113 | int snap_tolerance; | |||
114 | CtkSettings *ctk_settings; | |||
115 | ||||
116 | PanelState state; | |||
117 | ||||
118 | char *name; | |||
119 | char *description; | |||
120 | ||||
121 | guint hide_timeout; | |||
122 | guint unhide_timeout; | |||
123 | ||||
124 | CdkRectangle geometry; | |||
125 | PanelFrameEdge edges; | |||
126 | ||||
127 | int original_width; | |||
128 | int original_height; | |||
129 | ||||
130 | PanelGrabOpType grab_op; | |||
131 | ||||
132 | /* The offset within the panel from which the panel | |||
133 | * drag was initiated relative to the screen origin. | |||
134 | */ | |||
135 | int drag_offset_x; | |||
136 | int drag_offset_y; | |||
137 | ||||
138 | /* Saved state before for cancelled grab op */ | |||
139 | int orig_monitor; | |||
140 | int orig_x; | |||
141 | int orig_y; | |||
142 | int orig_x_right; | |||
143 | int orig_y_bottom; | |||
144 | int orig_size; | |||
145 | int orig_orientation; | |||
146 | ||||
147 | /* relative to the monitor origin */ | |||
148 | int animation_end_x; | |||
149 | int animation_end_y; | |||
150 | int animation_end_width; | |||
151 | int animation_end_height; | |||
152 | GTimeVal animation_start_time; | |||
153 | GTimeVal animation_end_time; | |||
154 | guint animation_timeout; | |||
155 | ||||
156 | PanelWidget *panel_widget; | |||
157 | PanelFrame *inner_frame; | |||
158 | CtkWidget *grid; | |||
159 | CtkWidget *hide_button_top; | |||
160 | CtkWidget *hide_button_bottom; | |||
161 | CtkWidget *hide_button_left; | |||
162 | CtkWidget *hide_button_right; | |||
163 | ||||
164 | PanelToplevel *attach_toplevel; | |||
165 | gulong attach_toplevel_signals [N_ATTACH_TOPLEVEL_SIGNALS5]; | |||
166 | CtkWidget *attach_widget; | |||
167 | gulong attach_widget_signals [N_ATTACH_WIDGET_SIGNALS5]; | |||
168 | gint n_autohide_disablers; | |||
169 | ||||
170 | guint auto_hide : 1; | |||
171 | guint anicafe : 1; | |||
172 | guint buttons_enabled : 1; | |||
173 | guint arrows_enabled : 1; | |||
174 | ||||
175 | /* The co-ordinates are relative to center screen */ | |||
176 | guint x_centered : 1; | |||
177 | guint y_centered : 1; | |||
178 | ||||
179 | /* The panel is not lined up with th screen edge */ | |||
180 | guint floating : 1; | |||
181 | ||||
182 | /* We are currently animating a hide/show */ | |||
183 | guint animating : 1; | |||
184 | ||||
185 | /* This is a keyboard initiated grab operation */ | |||
186 | guint grab_is_keyboard : 1; | |||
187 | ||||
188 | /* The x-y co-ordinates temporarily specify the panel center. | |||
189 | * This is used when the panel is rotating, because the width/height | |||
190 | * of the toplevel might change, so we need to compute new values for | |||
191 | * those. */ | |||
192 | guint position_centered : 1; | |||
193 | ||||
194 | /* The toplevel is "attached" to another widget */ | |||
195 | guint attached : 1; | |||
196 | ||||
197 | /* Hidden temporarily because the attach_toplevel was hidden */ | |||
198 | guint attach_hidden : 1; | |||
199 | ||||
200 | /* More saved grab op state */ | |||
201 | guint orig_x_centered : 1; | |||
202 | guint orig_y_centered : 1; | |||
203 | ||||
204 | /* flag to see if we have already done geometry updating, | |||
205 | if not then we're still loading and can ignore many things */ | |||
206 | guint updated_geometry_initial : 1; | |||
207 | /* flag to see if we have done the initial animation */ | |||
208 | guint initial_animation_done : 1; | |||
209 | }; | |||
210 | ||||
211 | enum { | |||
212 | HIDE_SIGNAL, | |||
213 | UNHIDE_SIGNAL, | |||
214 | POPUP_PANEL_MENU_SIGNAL, | |||
215 | TOGGLE_EXPAND_SIGNAL, | |||
216 | EXPAND_SIGNAL, | |||
217 | UNEXPAND_SIGNAL, | |||
218 | TOGGLE_HIDDEN_SIGNAL, | |||
219 | BEGIN_MOVE_SIGNAL, | |||
220 | BEGIN_RESIZE_SIGNAL, | |||
221 | LAST_SIGNAL | |||
222 | }; | |||
223 | ||||
224 | enum { | |||
225 | PROP_0, | |||
226 | PROP_NAME, | |||
227 | PROP_SETTINGS_PATH, | |||
228 | PROP_EXPAND, | |||
229 | PROP_ORIENTATION, | |||
230 | PROP_SIZE, | |||
231 | PROP_X, | |||
232 | PROP_X_RIGHT, | |||
233 | PROP_X_CENTERED, | |||
234 | PROP_Y, | |||
235 | PROP_Y_BOTTOM, | |||
236 | PROP_Y_CENTERED, | |||
237 | PROP_MONITOR, | |||
238 | PROP_AUTOHIDE, | |||
239 | PROP_HIDE_DELAY, | |||
240 | PROP_UNHIDE_DELAY, | |||
241 | PROP_AUTOHIDE_SIZE, | |||
242 | PROP_ANICAFE, | |||
243 | PROP_ANIMATION_SPEED, | |||
244 | PROP_BUTTONS_ENABLED, | |||
245 | PROP_ARROWS_ENABLED | |||
246 | }; | |||
247 | ||||
248 | G_DEFINE_TYPE_WITH_PRIVATE (PanelToplevel, panel_toplevel, CTK_TYPE_WINDOW)static void panel_toplevel_init (PanelToplevel *self); static void panel_toplevel_class_init (PanelToplevelClass *klass); static GType panel_toplevel_get_type_once (void); static gpointer panel_toplevel_parent_class = ((void*)0); static gint PanelToplevel_private_offset; static void panel_toplevel_class_intern_init (gpointer klass) { panel_toplevel_parent_class = g_type_class_peek_parent (klass); if (PanelToplevel_private_offset != 0) g_type_class_adjust_private_offset (klass, &PanelToplevel_private_offset ); panel_toplevel_class_init ((PanelToplevelClass*) klass); } __attribute__ ((__unused__)) static inline gpointer panel_toplevel_get_instance_private (PanelToplevel *self) { return (((gpointer) ((guint8*) (self ) + (glong) (PanelToplevel_private_offset)))); } GType panel_toplevel_get_type (void) { static gsize static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer), "Expression evaluates to false"); (void) ( 0 ? (gpointer) *(&static_g_define_type_id) : ((void*)0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter (&static_g_define_type_id )); }))) { GType g_define_type_id = panel_toplevel_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id) = (g_define_type_id) ) : (void) 0; g_once_init_leave ((&static_g_define_type_id ), (gsize) (g_define_type_id)); })); } return static_g_define_type_id ; } __attribute__ ((__noinline__)) static GType panel_toplevel_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_window_get_type ()), g_intern_static_string ("PanelToplevel" ), sizeof (PanelToplevelClass), (GClassInitFunc)(void (*)(void )) panel_toplevel_class_intern_init, sizeof (PanelToplevel), ( GInstanceInitFunc)(void (*)(void)) panel_toplevel_init, (GTypeFlags ) 0); { {{ PanelToplevel_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (PanelToplevelPrivate)); };} } return g_define_type_id; } | |||
249 | ||||
250 | static guint toplevel_signals[LAST_SIGNAL] = {0}; | |||
251 | static GSList* toplevel_list = NULL((void*)0); | |||
252 | ||||
253 | static void panel_toplevel_calculate_animation_end_geometry(PanelToplevel *toplevel); | |||
254 | ||||
255 | static void panel_toplevel_update_monitor(PanelToplevel* toplevel); | |||
256 | static void panel_toplevel_set_monitor_internal(PanelToplevel* toplevel, int monitor, gboolean force_resize); | |||
257 | ||||
258 | static void panel_toplevel_drag_threshold_changed (PanelToplevel *toplevel); | |||
259 | ||||
260 | static void | |||
261 | update_style_classes (PanelToplevel *toplevel) | |||
262 | { | |||
263 | CtkStyleContext *context; | |||
264 | ||||
265 | context = ctk_widget_get_style_context (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
266 | ||||
267 | /*ensure the panel BG can always be themed*/ | |||
268 | /*Without this ctk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/ | |||
269 | ctk_style_context_add_class(context,"gnome-panel-menu-bar"); | |||
270 | ctk_style_context_add_class(context,"cafe-panel-menu-bar"); | |||
271 | ||||
272 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_HORIZONTAL"horizontal"); | |||
273 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_VERTICAL"vertical"); | |||
274 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_RIGHT"right"); | |||
275 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_LEFT"left"); | |||
276 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_TOP"top"); | |||
277 | ctk_style_context_remove_class (context, CTK_STYLE_CLASS_BOTTOM"bottom"); | |||
278 | ||||
279 | switch (toplevel->priv->orientation) { | |||
280 | case PANEL_ORIENTATION_TOP: | |||
281 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_HORIZONTAL"horizontal"); | |||
282 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_TOP"top"); | |||
283 | break; | |||
284 | ||||
285 | case PANEL_ORIENTATION_LEFT: | |||
286 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_VERTICAL"vertical"); | |||
287 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_LEFT"left"); | |||
288 | break; | |||
289 | ||||
290 | case PANEL_ORIENTATION_BOTTOM: | |||
291 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_HORIZONTAL"horizontal"); | |||
292 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_BOTTOM"bottom"); | |||
293 | break; | |||
294 | ||||
295 | case PANEL_ORIENTATION_RIGHT: | |||
296 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_VERTICAL"vertical"); | |||
297 | ctk_style_context_add_class (context, CTK_STYLE_CLASS_RIGHT"right"); | |||
298 | break; | |||
299 | ||||
300 | default: | |||
301 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 301, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
302 | break; | |||
303 | } | |||
304 | } | |||
305 | ||||
306 | GSList* panel_toplevel_list_toplevels(void) | |||
307 | { | |||
308 | return toplevel_list; | |||
309 | } | |||
310 | ||||
311 | /* Is this the last un-attached toplevel? */ | |||
312 | gboolean panel_toplevel_is_last_unattached(PanelToplevel* toplevel) | |||
313 | { | |||
314 | GSList* l; | |||
315 | ||||
316 | if (panel_toplevel_get_is_attached(toplevel)) | |||
317 | { | |||
318 | return FALSE(0); | |||
319 | } | |||
320 | ||||
321 | for (l = toplevel_list; l; l = l->next) | |||
322 | { | |||
323 | PanelToplevel* t = l->data; | |||
324 | ||||
325 | if (t != toplevel && !panel_toplevel_get_is_attached(t)) | |||
326 | { | |||
327 | return FALSE(0); | |||
328 | } | |||
329 | } | |||
330 | ||||
331 | return TRUE(!(0)); | |||
332 | } | |||
333 | ||||
334 | static void panel_toplevel_get_monitor_geometry(PanelToplevel* toplevel, CdkRectangle *geom) | |||
335 | { | |||
336 | g_return_if_fail(PANEL_IS_TOPLEVEL(toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL(toplevel)"); return; } } while (0); | |||
337 | g_return_if_fail(geom)do { if ((geom)) { } else { g_return_if_fail_warning (((gchar *) 0), ((const char*) (__func__)), "geom"); return; } } while (0); | |||
338 | ||||
339 | geom->x = panel_multimonitor_x(toplevel->priv->monitor); | |||
340 | geom->y = panel_multimonitor_y(toplevel->priv->monitor); | |||
341 | geom->width = panel_multimonitor_width(toplevel->priv->monitor); | |||
342 | geom->height = panel_multimonitor_height(toplevel->priv->monitor); | |||
343 | } | |||
344 | ||||
345 | static CdkCursorType panel_toplevel_grab_op_cursor(PanelToplevel* toplevel, PanelGrabOpType grab_op) | |||
346 | { | |||
347 | CdkCursorType retval = -1; | |||
348 | ||||
349 | switch (grab_op) { | |||
350 | case PANEL_GRAB_OP_MOVE: | |||
351 | case PANEL_GRAB_OP_RESIZE: | |||
352 | if (toplevel->priv->grab_is_keyboard) | |||
353 | retval = CDK_CROSS; | |||
354 | else | |||
355 | retval = CDK_FLEUR; | |||
356 | break; | |||
357 | case PANEL_GRAB_OP_RESIZE_UP: | |||
358 | retval = CDK_TOP_SIDE; | |||
359 | break; | |||
360 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
361 | retval = CDK_BOTTOM_SIDE; | |||
362 | break; | |||
363 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
364 | retval = CDK_LEFT_SIDE; | |||
365 | break; | |||
366 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
367 | retval = CDK_RIGHT_SIDE; | |||
368 | break; | |||
369 | default: | |||
370 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 370, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
371 | break; | |||
372 | } | |||
373 | ||||
374 | return retval; | |||
375 | } | |||
376 | ||||
377 | #ifdef HAVE_X111 | |||
378 | static void panel_toplevel_init_resize_drag_offsets(PanelToplevel* toplevel, PanelGrabOpType grab_op) | |||
379 | { | |||
380 | g_assert (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel))))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 380 , ((const char*) (__func__)), "CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))" ); } while (0); | |||
381 | ||||
382 | toplevel->priv->drag_offset_x = 0; | |||
383 | toplevel->priv->drag_offset_y = 0; | |||
384 | ||||
385 | switch (grab_op) { | |||
386 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
387 | toplevel->priv->drag_offset_y = toplevel->priv->geometry.y; | |||
388 | break; | |||
389 | case PANEL_GRAB_OP_RESIZE_UP: | |||
390 | toplevel->priv->drag_offset_y = | |||
391 | toplevel->priv->geometry.y + toplevel->priv->geometry.height; | |||
392 | break; | |||
393 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
394 | toplevel->priv->drag_offset_x = toplevel->priv->geometry.x; | |||
395 | break; | |||
396 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
397 | toplevel->priv->drag_offset_x = | |||
398 | toplevel->priv->geometry.x + toplevel->priv->geometry.width; | |||
399 | break; | |||
400 | default: | |||
401 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 401, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
402 | break; | |||
403 | } | |||
404 | } | |||
405 | ||||
406 | static void panel_toplevel_warp_pointer(PanelToplevel* toplevel) | |||
407 | { | |||
408 | CtkWidget *widget; | |||
409 | CdkRectangle geometry; | |||
410 | int x, y; | |||
411 | ||||
412 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
413 | g_return_if_fail (CDK_IS_X11_DISPLAY (ctk_widget_get_display (widget)))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((ctk_widget_get_display (widget))); GType __t = ((cdk_x11_display_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0 ), ((const char*) (__func__)), "CDK_IS_X11_DISPLAY (ctk_widget_get_display (widget))" ); return; } } while (0); | |||
414 | ||||
415 | geometry = toplevel->priv->geometry; | |||
416 | ||||
417 | x = y = 0; | |||
418 | ||||
419 | switch (toplevel->priv->grab_op) { | |||
420 | case PANEL_GRAB_OP_MOVE: | |||
421 | case PANEL_GRAB_OP_RESIZE: | |||
422 | x = (geometry.width / 2); | |||
423 | y = (geometry.height / 2); | |||
424 | break; | |||
425 | case PANEL_GRAB_OP_RESIZE_UP: | |||
426 | x = (geometry.width / 2); | |||
427 | break; | |||
428 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
429 | x = (geometry.width / 2); | |||
430 | y = geometry.height; | |||
431 | break; | |||
432 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
433 | y = (geometry.height / 2); | |||
434 | break; | |||
435 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
436 | x = geometry.width; | |||
437 | y = (geometry.height / 2); | |||
438 | break; | |||
439 | default: | |||
440 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 440, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
441 | break; | |||
442 | } | |||
443 | ||||
444 | if (toplevel->priv->grab_op == PANEL_GRAB_OP_MOVE || | |||
445 | toplevel->priv->grab_op == PANEL_GRAB_OP_RESIZE) { | |||
446 | toplevel->priv->drag_offset_x = x; | |||
447 | toplevel->priv->drag_offset_y = y; | |||
448 | } else | |||
449 | panel_toplevel_init_resize_drag_offsets (toplevel, toplevel->priv->grab_op); | |||
450 | ||||
451 | panel_warp_pointer (ctk_widget_get_window (widget), x, y); | |||
452 | } | |||
453 | #endif // HAVE_X11 | |||
454 | ||||
455 | static void panel_toplevel_begin_attached_move(PanelToplevel* toplevel, gboolean is_keyboard, guint32 time_) | |||
456 | { | |||
457 | PanelWidget *attached_panel_widget; | |||
458 | ||||
459 | attached_panel_widget = panel_toplevel_get_panel_widget (toplevel->priv->attach_toplevel); | |||
460 | ||||
461 | panel_widget_applet_drag_start (attached_panel_widget, | |||
462 | toplevel->priv->attach_widget, | |||
463 | is_keyboard ? PW_DRAG_OFF_CENTER-2 : PW_DRAG_OFF_CURSOR-1, | |||
464 | time_); | |||
465 | } | |||
466 | ||||
467 | static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpType op_type, gboolean grab_keyboard, guint32 time_) | |||
468 | { | |||
469 | CtkWidget *widget; | |||
470 | CdkWindow *window; | |||
471 | CdkCursorType cursor_type; | |||
472 | CdkCursor *cursor; | |||
473 | CdkDisplay *display; | |||
474 | CdkSeat *seat; | |||
475 | CdkSeatCapabilities capabilities; | |||
476 | ||||
477 | if (toplevel->priv->state != PANEL_STATE_NORMAL || | |||
478 | toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) | |||
479 | return; | |||
480 | ||||
481 | if (panel_lockdown_get_locked_down ()) | |||
482 | return; | |||
483 | ||||
484 | /* If any of the position/orientation are not writable, | |||
485 | then we can't really move freely */ | |||
486 | if (op_type == PANEL_GRAB_OP_MOVE && | |||
487 | ! panel_profile_can_be_moved_freely (toplevel)) | |||
488 | return; | |||
489 | ||||
490 | /* If size is not writable, then we can't resize */ | |||
491 | if ((op_type == PANEL_GRAB_OP_RESIZE || | |||
492 | op_type == PANEL_GRAB_OP_RESIZE_UP || | |||
493 | op_type == PANEL_GRAB_OP_RESIZE_DOWN || | |||
494 | op_type == PANEL_GRAB_OP_RESIZE_LEFT || | |||
495 | op_type == PANEL_GRAB_OP_RESIZE_RIGHT) && | |||
496 | ! panel_profile_key_is_writable (toplevel, PANEL_TOPLEVEL_SIZE_KEY"size")) | |||
497 | return; | |||
498 | ||||
499 | if (toplevel->priv->attached && op_type == PANEL_GRAB_OP_MOVE) { | |||
500 | panel_toplevel_begin_attached_move (toplevel, grab_keyboard, time_); | |||
501 | return; | |||
502 | } | |||
503 | ||||
504 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
505 | window = ctk_widget_get_window (widget); | |||
506 | ||||
507 | toplevel->priv->grab_op = op_type; | |||
508 | toplevel->priv->grab_is_keyboard = grab_keyboard; | |||
509 | ||||
510 | toplevel->priv->orig_monitor = toplevel->priv->monitor; | |||
511 | toplevel->priv->orig_x = toplevel->priv->x; | |||
512 | toplevel->priv->orig_x_right = toplevel->priv->x_right; | |||
513 | toplevel->priv->orig_x_centered = toplevel->priv->x_centered; | |||
514 | toplevel->priv->orig_y = toplevel->priv->y; | |||
515 | toplevel->priv->orig_y_bottom = toplevel->priv->y_bottom; | |||
516 | toplevel->priv->orig_y_centered = toplevel->priv->y_centered; | |||
517 | toplevel->priv->orig_size = toplevel->priv->size; | |||
518 | toplevel->priv->orig_orientation = toplevel->priv->orientation; | |||
519 | ||||
520 | ctk_grab_add (widget); | |||
521 | ||||
522 | #ifdef HAVE_X111 | |||
523 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (widget))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (widget))); GType __t = ((cdk_x11_display_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) && | |||
524 | toplevel->priv->grab_is_keyboard) { | |||
525 | panel_toplevel_warp_pointer (toplevel); | |||
526 | } | |||
527 | #endif // HAVE_X11 | |||
528 | ||||
529 | cursor_type = panel_toplevel_grab_op_cursor ( | |||
530 | toplevel, toplevel->priv->grab_op); | |||
531 | ||||
532 | ||||
533 | cursor = cdk_cursor_new_for_display (cdk_display_get_default (), | |||
534 | cursor_type); | |||
535 | display = cdk_window_get_display (window); | |||
536 | seat = cdk_display_get_default_seat (display); | |||
537 | capabilities = CDK_SEAT_CAPABILITY_POINTER; | |||
538 | if (grab_keyboard) | |||
539 | capabilities |= CDK_SEAT_CAPABILITY_KEYBOARD; | |||
540 | ||||
541 | cdk_seat_grab (seat, window, capabilities, FALSE(0), cursor, | |||
542 | NULL((void*)0), NULL((void*)0), NULL((void*)0)); | |||
543 | ||||
544 | g_object_unref (cursor); | |||
545 | } | |||
546 | ||||
547 | static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) | |||
548 | { | |||
549 | CtkWidget *widget; | |||
550 | CdkDisplay *display; | |||
551 | CdkSeat *seat; | |||
552 | ||||
553 | g_return_if_fail (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE)do { if ((toplevel->priv->grab_op != PANEL_GRAB_OP_NONE )) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel->priv->grab_op != PANEL_GRAB_OP_NONE" ); return; } } while (0); | |||
554 | ||||
555 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
556 | ||||
557 | toplevel->priv->grab_op = PANEL_GRAB_OP_NONE; | |||
558 | toplevel->priv->grab_is_keyboard = FALSE(0); | |||
559 | ||||
560 | ctk_grab_remove (widget); | |||
561 | ||||
562 | display = ctk_widget_get_display (widget); | |||
563 | seat = cdk_display_get_default_seat (display); | |||
564 | ||||
565 | cdk_seat_ungrab (seat); | |||
566 | } | |||
567 | ||||
568 | static void panel_toplevel_cancel_grab_op(PanelToplevel* toplevel, guint32 time_) | |||
569 | { | |||
570 | panel_toplevel_set_orientation (toplevel, toplevel->priv->orig_orientation); | |||
571 | panel_toplevel_set_monitor (toplevel, toplevel->priv->orig_monitor); | |||
572 | panel_toplevel_set_size (toplevel, toplevel->priv->orig_size); | |||
573 | panel_toplevel_set_x (toplevel, | |||
574 | toplevel->priv->orig_x, | |||
575 | toplevel->priv->orig_x_right, | |||
576 | toplevel->priv->orig_x_centered); | |||
577 | panel_toplevel_set_y (toplevel, | |||
578 | toplevel->priv->orig_y, | |||
579 | toplevel->priv->orig_y_bottom, | |||
580 | toplevel->priv->orig_y_centered); | |||
581 | } | |||
582 | ||||
583 | static void panel_toplevel_resize_to_pointer(PanelToplevel* toplevel, int x, int y) | |||
584 | { | |||
585 | int new_size; | |||
586 | int new_x, new_y; | |||
587 | int new_x_right, new_y_bottom; | |||
588 | int new_x_centered, new_y_centered; | |||
589 | CdkRectangle monitor_geom; | |||
590 | ||||
591 | new_size = toplevel->priv->size; | |||
592 | new_x = toplevel->priv->x; | |||
593 | new_y = toplevel->priv->y; | |||
594 | new_x_right = toplevel->priv->x_right; | |||
595 | new_y_bottom = toplevel->priv->y_bottom; | |||
596 | new_x_centered = toplevel->priv->x_centered; | |||
597 | new_y_centered = toplevel->priv->y_centered; | |||
598 | ||||
599 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
600 | ||||
601 | switch (toplevel->priv->grab_op) { | |||
602 | case PANEL_GRAB_OP_RESIZE_UP: | |||
603 | new_size = toplevel->priv->drag_offset_y - y; | |||
604 | new_size = CLAMP (new_size, 0, monitor_geom.height / 4)(((new_size) > (monitor_geom.height / 4)) ? (monitor_geom. height / 4) : (((new_size) < (0)) ? (0) : (new_size))); | |||
605 | new_y -= (new_size - toplevel->priv->size); | |||
606 | if (!toplevel->priv->y_centered && (new_y + new_size / 2) > monitor_geom.height / 2) | |||
607 | new_y_bottom = monitor_geom.height - (new_y + new_size); | |||
608 | else | |||
609 | new_y_bottom = -1; | |||
610 | break; | |||
611 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
612 | new_size = y - toplevel->priv->drag_offset_y; | |||
613 | new_size = CLAMP (new_size, 0, monitor_geom.height / 4)(((new_size) > (monitor_geom.height / 4)) ? (monitor_geom. height / 4) : (((new_size) < (0)) ? (0) : (new_size))); | |||
614 | if (!toplevel->priv->y_centered && (new_y + new_size / 2) > monitor_geom.height / 2) | |||
615 | new_y_bottom = monitor_geom.height - (new_y + new_size); | |||
616 | else | |||
617 | new_y_bottom = -1; | |||
618 | break; | |||
619 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
620 | new_size = toplevel->priv->drag_offset_x - x; | |||
621 | new_size = CLAMP (new_size, 0, monitor_geom.width / 4)(((new_size) > (monitor_geom.width / 4)) ? (monitor_geom.width / 4) : (((new_size) < (0)) ? (0) : (new_size))); | |||
622 | new_x -= (new_size - toplevel->priv->size); | |||
623 | if (!toplevel->priv->x_centered && (new_x + new_size / 2) > monitor_geom.width / 2) | |||
624 | new_x_right = monitor_geom.width - (new_x + new_size); | |||
625 | else | |||
626 | new_x_right = -1; | |||
627 | break; | |||
628 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
629 | new_size = x - toplevel->priv->drag_offset_x; | |||
630 | new_size = CLAMP (new_size, 0, monitor_geom.width / 4)(((new_size) > (monitor_geom.width / 4)) ? (monitor_geom.width / 4) : (((new_size) < (0)) ? (0) : (new_size))); | |||
631 | if (!toplevel->priv->x_centered && (new_x + new_size / 2) > monitor_geom.width / 2) | |||
632 | new_x_right = monitor_geom.width - (new_x + new_size); | |||
633 | else | |||
634 | new_x_right = -1; | |||
635 | break; | |||
636 | default: | |||
637 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 637, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
638 | break; | |||
639 | } | |||
640 | ||||
641 | if (new_size == 0) | |||
642 | return; | |||
643 | ||||
644 | panel_toplevel_set_x (toplevel, new_x, new_x_right, new_x_centered); | |||
645 | panel_toplevel_set_y (toplevel, new_y, new_y_bottom, new_y_centered); | |||
646 | panel_toplevel_set_size (toplevel, new_size); | |||
647 | } | |||
648 | ||||
649 | /* this is called for expanded panels that are dragged around */ | |||
650 | static void panel_toplevel_calc_new_orientation(PanelToplevel* toplevel, int pointer_x, int pointer_y) | |||
651 | { | |||
652 | PanelOrientation new_orientation; | |||
653 | int hborder, vborder; | |||
654 | int monitor; | |||
655 | int monitor_width, monitor_height; | |||
656 | int new_x, new_y; | |||
657 | ||||
658 | monitor = panel_multimonitor_get_monitor_at_point (pointer_x, pointer_y); | |||
659 | ||||
660 | if (toplevel->priv->geometry.height < toplevel->priv->geometry.width) | |||
661 | vborder = hborder = (3 * toplevel->priv->geometry.height) >> 1; | |||
662 | else | |||
663 | vborder = hborder = (3 * toplevel->priv->geometry.width) >> 1; | |||
664 | ||||
665 | new_x = pointer_x - panel_multimonitor_x (monitor); | |||
666 | new_y = pointer_y - panel_multimonitor_y (monitor); | |||
667 | monitor_width = panel_multimonitor_width (monitor); | |||
668 | monitor_height = panel_multimonitor_height (monitor); | |||
669 | ||||
670 | new_orientation = toplevel->priv->orientation; | |||
671 | ||||
672 | switch (toplevel->priv->orientation) { | |||
673 | case PANEL_ORIENTATION_TOP: | |||
674 | if (new_y > (monitor_height - hborder)) | |||
675 | new_orientation = PANEL_ORIENTATION_BOTTOM; | |||
676 | ||||
677 | else if (new_y > hborder) { | |||
678 | if (new_x > (monitor_width - vborder)) | |||
679 | new_orientation = PANEL_ORIENTATION_RIGHT; | |||
680 | else if (new_x < vborder) | |||
681 | new_orientation = PANEL_ORIENTATION_LEFT; | |||
682 | } | |||
683 | break; | |||
684 | case PANEL_ORIENTATION_BOTTOM: | |||
685 | if (new_y < hborder) | |||
686 | new_orientation = PANEL_ORIENTATION_TOP; | |||
687 | ||||
688 | else if (new_y < (monitor_height - hborder)) { | |||
689 | if (new_x > (monitor_width - vborder)) | |||
690 | new_orientation = PANEL_ORIENTATION_RIGHT; | |||
691 | else if (new_x < vborder) | |||
692 | new_orientation = PANEL_ORIENTATION_LEFT; | |||
693 | } | |||
694 | break; | |||
695 | case PANEL_ORIENTATION_LEFT: | |||
696 | if (new_x > (monitor_width - vborder)) | |||
697 | new_orientation = PANEL_ORIENTATION_RIGHT; | |||
698 | ||||
699 | else if (new_x > vborder) { | |||
700 | if (new_y > (monitor_height - hborder)) | |||
701 | new_orientation = PANEL_ORIENTATION_BOTTOM; | |||
702 | else if (new_y < hborder) | |||
703 | new_orientation = PANEL_ORIENTATION_TOP; | |||
704 | } | |||
705 | break; | |||
706 | case PANEL_ORIENTATION_RIGHT: | |||
707 | if (new_x < vborder) | |||
708 | new_orientation = PANEL_ORIENTATION_LEFT; | |||
709 | ||||
710 | else if (new_x < (monitor_width - vborder)) { | |||
711 | if (new_y > (monitor_height - hborder)) | |||
712 | new_orientation = PANEL_ORIENTATION_BOTTOM; | |||
713 | else if (new_y < hborder) | |||
714 | new_orientation = PANEL_ORIENTATION_TOP; | |||
715 | } | |||
716 | break; | |||
717 | default: | |||
718 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 718, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
719 | break; | |||
720 | } | |||
721 | ||||
722 | panel_toplevel_set_monitor (toplevel, monitor); | |||
723 | panel_toplevel_set_orientation (toplevel, new_orientation); | |||
724 | } | |||
725 | ||||
726 | static void panel_toplevel_move_to(PanelToplevel* toplevel, int new_x, int new_y) | |||
727 | { | |||
728 | PanelOrientation new_orientation; | |||
729 | gboolean x_centered, y_centered; | |||
730 | CdkPoint display_min, display_max; | |||
731 | CdkRectangle monitor_geom; | |||
732 | int width, height; | |||
733 | int new_monitor; | |||
734 | int x, y, x_right, y_bottom; | |||
735 | int snap_tolerance; | |||
736 | ||||
737 | panel_multimonitor_get_bounds (&display_min, &display_max); | |||
738 | ||||
739 | width = toplevel->priv->geometry.width; | |||
740 | height = toplevel->priv->geometry.height; | |||
741 | ||||
742 | snap_tolerance = toplevel->priv->snap_tolerance; | |||
743 | ||||
744 | new_x = CLAMP (new_x, 0, display_max.x - width)(((new_x) > (display_max.x - width)) ? (display_max.x - width ) : (((new_x) < (0)) ? (0) : (new_x))); | |||
745 | new_y = CLAMP (new_y, 0, display_max.y - height)(((new_y) > (display_max.y - height)) ? (display_max.y - height ) : (((new_y) < (0)) ? (0) : (new_y))); | |||
746 | ||||
747 | new_orientation = toplevel->priv->orientation; | |||
748 | ||||
749 | if (new_x <= (display_min.x + snap_tolerance) && | |||
750 | toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
751 | new_orientation = PANEL_ORIENTATION_LEFT; | |||
752 | ||||
753 | else if ((new_x + width) >= (display_max.x - snap_tolerance) && | |||
754 | toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
755 | new_orientation = PANEL_ORIENTATION_RIGHT; | |||
756 | ||||
757 | if (new_y <= (display_min.y + snap_tolerance) && | |||
758 | toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
759 | new_orientation = PANEL_ORIENTATION_TOP; | |||
760 | ||||
761 | else if ((new_y + height) >= (display_max.y - snap_tolerance) && | |||
762 | toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
763 | new_orientation = PANEL_ORIENTATION_BOTTOM; | |||
764 | ||||
765 | new_monitor = panel_multimonitor_get_monitor_at_point (new_x, new_y); | |||
766 | ||||
767 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
768 | ||||
769 | x_centered = toplevel->priv->x_centered; | |||
770 | y_centered = toplevel->priv->y_centered; | |||
771 | ||||
772 | x = new_x - panel_multimonitor_x (new_monitor); | |||
773 | y = new_y - panel_multimonitor_y (new_monitor); | |||
774 | ||||
775 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
776 | y_centered = FALSE(0); | |||
777 | if (new_y <= display_min.y + snap_tolerance || | |||
778 | new_y + height >= display_max.y - snap_tolerance) | |||
779 | x_centered = abs (x - ((monitor_geom.width - width) / 2)) | |||
780 | <= snap_tolerance; | |||
781 | else | |||
782 | x_centered = FALSE(0); | |||
783 | } else { | |||
784 | x_centered = FALSE(0); | |||
785 | if (new_x <= display_min.x + snap_tolerance || | |||
786 | new_x + width >= display_max.x - snap_tolerance) | |||
787 | y_centered = abs (y - ((monitor_geom.height - height) / 2)) | |||
788 | <= snap_tolerance; | |||
789 | else | |||
790 | y_centered = FALSE(0); | |||
791 | } | |||
792 | ||||
793 | if (x_centered) | |||
794 | x = (monitor_geom.width - width) / 2; | |||
795 | if (y_centered) | |||
796 | y = (monitor_geom.height - height) / 2; | |||
797 | ||||
798 | if (!x_centered && (x + width / 2) > monitor_geom.width / 2) | |||
799 | x_right = monitor_geom.width - (x + width); | |||
800 | else | |||
801 | x_right = -1; | |||
802 | ||||
803 | if (!y_centered && (y + height / 2) > monitor_geom.height / 2) | |||
804 | y_bottom = monitor_geom.height - (y + height); | |||
805 | else | |||
806 | y_bottom = -1; | |||
807 | ||||
808 | panel_toplevel_set_monitor (toplevel, new_monitor); | |||
809 | panel_toplevel_set_orientation (toplevel, new_orientation); | |||
810 | panel_toplevel_set_x (toplevel, x, x_right, x_centered); | |||
811 | panel_toplevel_set_y (toplevel, y, y_bottom, y_centered); | |||
812 | } | |||
813 | ||||
814 | static void panel_toplevel_move_to_pointer(PanelToplevel* toplevel, int pointer_x, int pointer_y) | |||
815 | { | |||
816 | int new_x, new_y; | |||
817 | ||||
818 | new_x = pointer_x - toplevel->priv->drag_offset_x; | |||
819 | new_y = pointer_y - toplevel->priv->drag_offset_y; | |||
820 | ||||
821 | panel_toplevel_move_to (toplevel, new_x, new_y); | |||
822 | } | |||
823 | ||||
824 | static void panel_toplevel_rotate_to_pointer(PanelToplevel* toplevel, int pointer_x, int pointer_y) | |||
825 | { | |||
826 | int x_diff, y_diff; | |||
827 | int x, y; | |||
828 | int snap_tolerance; | |||
829 | ||||
830 | x = toplevel->priv->geometry.x; | |||
831 | y = toplevel->priv->geometry.y; | |||
832 | snap_tolerance = toplevel->priv->snap_tolerance; | |||
833 | ||||
834 | x_diff = pointer_x - (x + toplevel->priv->geometry.width / 2); | |||
835 | y_diff = pointer_y - (y + toplevel->priv->geometry.height / 2); | |||
836 | ||||
837 | if (((-y_diff > x_diff + snap_tolerance) && x_diff > 0 && y_diff < 0) || | |||
838 | (( y_diff < x_diff + snap_tolerance) && x_diff < 0 && y_diff < 0)) | |||
839 | panel_toplevel_set_orientation (toplevel, PANEL_ORIENTATION_RIGHT); | |||
840 | ||||
841 | else if (((-x_diff < y_diff - snap_tolerance) && x_diff > 0 && y_diff < 0) || | |||
842 | (( x_diff > y_diff - snap_tolerance) && x_diff > 0 && y_diff > 0)) | |||
843 | panel_toplevel_set_orientation (toplevel, PANEL_ORIENTATION_BOTTOM); | |||
844 | ||||
845 | else if ((( y_diff > x_diff + snap_tolerance) && x_diff > 0 && y_diff > 0) || | |||
846 | ((-y_diff < x_diff + snap_tolerance) && x_diff < 0 && y_diff > 0)) | |||
847 | panel_toplevel_set_orientation (toplevel, PANEL_ORIENTATION_LEFT); | |||
848 | ||||
849 | else if (((-x_diff > y_diff - snap_tolerance) && x_diff < 0 && y_diff > 0) || | |||
850 | (( x_diff < y_diff - snap_tolerance) && x_diff < 0 && y_diff < 0)) | |||
851 | panel_toplevel_set_orientation (toplevel, PANEL_ORIENTATION_TOP); | |||
852 | } | |||
853 | ||||
854 | #ifdef HAVE_X111 | |||
855 | static gboolean panel_toplevel_warp_pointer_increment(PanelToplevel* toplevel, int keyval, int increment) | |||
856 | { | |||
857 | CdkScreen *screen; | |||
858 | CdkWindow *root_window; | |||
859 | CdkDevice *device; | |||
860 | int new_x, new_y; | |||
861 | ||||
862 | screen = ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ()))))))); | |||
863 | g_return_val_if_fail (CDK_IS_X11_SCREEN (screen), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((screen)); GType __t = ((cdk_x11_screen_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "CDK_IS_X11_SCREEN (screen)"); return ((0)); } } while (0); | |||
864 | root_window = cdk_screen_get_root_window (screen); | |||
865 | device = cdk_seat_get_pointer (cdk_display_get_default_seat (ctk_widget_get_display (CTK_WIDGET(root_window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((root_window)), ((ctk_widget_get_type ()))))))))); | |||
866 | cdk_window_get_device_position (ctk_widget_get_window (CTK_WIDGET (root_window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((root_window)), ((ctk_widget_get_type ()))))))), device, &new_x, &new_y, NULL((void*)0)); | |||
867 | ||||
868 | switch (keyval) { | |||
869 | case CDK_KEY_Up0xff52: | |||
870 | case CDK_KEY_KP_Up0xff97: | |||
871 | new_y -= increment; | |||
872 | break; | |||
873 | case CDK_KEY_Left0xff51: | |||
874 | case CDK_KEY_KP_Left0xff96: | |||
875 | new_x -= increment; | |||
876 | break; | |||
877 | case CDK_KEY_Down0xff54: | |||
878 | case CDK_KEY_KP_Down0xff99: | |||
879 | new_y += increment; | |||
880 | break; | |||
881 | case CDK_KEY_Right0xff53: | |||
882 | case CDK_KEY_KP_Right0xff98: | |||
883 | new_x += increment; | |||
884 | break; | |||
885 | default: | |||
886 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 886, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
887 | return FALSE(0); | |||
888 | } | |||
889 | ||||
890 | panel_warp_pointer (root_window, new_x, new_y); | |||
891 | ||||
892 | return TRUE(!(0)); | |||
893 | } | |||
894 | ||||
895 | static gboolean panel_toplevel_move_keyboard_floating(PanelToplevel* toplevel, CdkEventKey* event) | |||
896 | { | |||
897 | #define SMALL_INCREMENT 1 | |||
898 | #define NORMAL_INCREMENT 10 | |||
899 | ||||
900 | int increment = NORMAL_INCREMENT; | |||
901 | ||||
902 | if ((event->state & ctk_accelerator_get_default_mod_mask ()) == CDK_SHIFT_MASK) | |||
903 | increment = SMALL_INCREMENT; | |||
904 | ||||
905 | return panel_toplevel_warp_pointer_increment ( | |||
906 | toplevel, event->keyval, increment); | |||
907 | ||||
908 | #undef SMALL_INCREMENT | |||
909 | #undef NORMAL_INCREMENT | |||
910 | } | |||
911 | ||||
912 | #endif // HAVE_X11 | |||
913 | ||||
914 | static gboolean panel_toplevel_move_keyboard_expanded(PanelToplevel* toplevel, CdkEventKey* event) | |||
915 | { | |||
916 | PanelOrientation new_orientation; | |||
917 | ||||
918 | switch (event->keyval) { | |||
919 | case CDK_KEY_Up0xff52: | |||
920 | case CDK_KEY_KP_Up0xff97: | |||
921 | new_orientation = PANEL_ORIENTATION_TOP; | |||
922 | break; | |||
923 | case CDK_KEY_Left0xff51: | |||
924 | case CDK_KEY_KP_Left0xff96: | |||
925 | new_orientation = PANEL_ORIENTATION_LEFT; | |||
926 | break; | |||
927 | case CDK_KEY_Down0xff54: | |||
928 | case CDK_KEY_KP_Down0xff99: | |||
929 | new_orientation = PANEL_ORIENTATION_BOTTOM; | |||
930 | break; | |||
931 | case CDK_KEY_Right0xff53: | |||
932 | case CDK_KEY_KP_Right0xff98: | |||
933 | new_orientation = PANEL_ORIENTATION_RIGHT; | |||
934 | break; | |||
935 | default: | |||
936 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 936, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
937 | return FALSE(0); | |||
938 | } | |||
939 | ||||
940 | panel_toplevel_set_orientation (toplevel, new_orientation); | |||
941 | ||||
942 | return TRUE(!(0)); | |||
943 | } | |||
944 | ||||
945 | static gboolean panel_toplevel_initial_resize_keypress(PanelToplevel* toplevel, CdkEventKey* event) | |||
946 | { | |||
947 | PanelGrabOpType grab_op; | |||
948 | ||||
949 | switch (event->keyval) { | |||
950 | case CDK_KEY_Up0xff52: | |||
951 | case CDK_KEY_KP_Up0xff97: | |||
952 | if (!(toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) | |||
953 | return FALSE(0); | |||
954 | grab_op = PANEL_GRAB_OP_RESIZE_UP; | |||
955 | break; | |||
956 | case CDK_KEY_Left0xff51: | |||
957 | case CDK_KEY_KP_Left0xff96: | |||
958 | if (!(toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) | |||
959 | return FALSE(0); | |||
960 | grab_op = PANEL_GRAB_OP_RESIZE_LEFT; | |||
961 | break; | |||
962 | case CDK_KEY_Down0xff54: | |||
963 | case CDK_KEY_KP_Down0xff99: | |||
964 | if (!(toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) | |||
965 | return FALSE(0); | |||
966 | grab_op = PANEL_GRAB_OP_RESIZE_DOWN; | |||
967 | break; | |||
968 | case CDK_KEY_Right0xff53: | |||
969 | case CDK_KEY_KP_Right0xff98: | |||
970 | if (!(toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) | |||
971 | return FALSE(0); | |||
972 | grab_op = PANEL_GRAB_OP_RESIZE_RIGHT; | |||
973 | break; | |||
974 | default: | |||
975 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 975, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
976 | return FALSE(0); | |||
977 | } | |||
978 | ||||
979 | panel_toplevel_end_grab_op (toplevel, event->time); | |||
980 | panel_toplevel_begin_grab_op (toplevel, grab_op, TRUE(!(0)), event->time); | |||
981 | ||||
982 | return TRUE(!(0)); | |||
983 | } | |||
984 | ||||
985 | static gboolean panel_toplevel_handle_grab_op_key_event(PanelToplevel* toplevel, CdkEventKey* event) | |||
986 | { | |||
987 | gboolean retval = FALSE(0); | |||
988 | ||||
989 | switch (event->keyval) { | |||
990 | case CDK_KEY_Up0xff52: | |||
991 | case CDK_KEY_KP_Up0xff97: | |||
992 | case CDK_KEY_Left0xff51: | |||
993 | case CDK_KEY_KP_Left0xff96: | |||
994 | case CDK_KEY_Down0xff54: | |||
995 | case CDK_KEY_KP_Down0xff99: | |||
996 | case CDK_KEY_Right0xff53: | |||
997 | case CDK_KEY_KP_Right0xff98: | |||
998 | switch (toplevel->priv->grab_op) { | |||
999 | case PANEL_GRAB_OP_MOVE: | |||
1000 | if (toplevel->priv->expand) { | |||
1001 | retval = panel_toplevel_move_keyboard_expanded ( | |||
1002 | toplevel, event); | |||
1003 | } | |||
1004 | #ifdef HAVE_X111 | |||
1005 | else if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { | |||
1006 | retval = panel_toplevel_move_keyboard_floating ( | |||
1007 | toplevel, event); | |||
1008 | } | |||
1009 | #endif // HAVE_X11 | |||
1010 | break; | |||
1011 | case PANEL_GRAB_OP_RESIZE: | |||
1012 | retval = panel_toplevel_initial_resize_keypress (toplevel, event); | |||
1013 | break; | |||
1014 | case PANEL_GRAB_OP_RESIZE_UP: | |||
1015 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
1016 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
1017 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
1018 | #ifdef HAVE_X111 | |||
1019 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) | |||
1020 | retval = panel_toplevel_warp_pointer_increment (toplevel, event->keyval, 1); | |||
1021 | #endif // HAVE_X11 | |||
1022 | break; | |||
1023 | default: | |||
1024 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1024, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1025 | break; | |||
1026 | } | |||
1027 | break; | |||
1028 | case CDK_KEY_Escape0xff1b: | |||
1029 | panel_toplevel_cancel_grab_op (toplevel, event->time); | |||
1030 | case CDK_KEY_Return0xff0d: /* drop through*/ | |||
1031 | case CDK_KEY_KP_Enter0xff8d: | |||
1032 | case CDK_KEY_space0x020: | |||
1033 | case CDK_KEY_KP_Space0xff80: | |||
1034 | panel_toplevel_end_grab_op (toplevel, event->time); | |||
1035 | retval = TRUE(!(0)); | |||
1036 | default: /* drop through*/ | |||
1037 | break; | |||
1038 | } | |||
1039 | ||||
1040 | return retval; | |||
1041 | } | |||
1042 | ||||
1043 | static gboolean panel_toplevel_handle_grab_op_motion_event(PanelToplevel* toplevel, CdkEventMotion* event) | |||
1044 | { | |||
1045 | switch (toplevel->priv->grab_op) { | |||
1046 | case PANEL_GRAB_OP_MOVE: | |||
1047 | if (toplevel->priv->expand) | |||
1048 | panel_toplevel_calc_new_orientation ( | |||
1049 | toplevel, event->x_root, event->y_root); | |||
1050 | ||||
1051 | else if ((event->state & ctk_accelerator_get_default_mod_mask ()) == CDK_CONTROL_MASK) | |||
1052 | panel_toplevel_rotate_to_pointer ( | |||
1053 | toplevel, event->x_root, event->y_root); | |||
1054 | ||||
1055 | else | |||
1056 | panel_toplevel_move_to_pointer ( | |||
1057 | toplevel, event->x_root, event->y_root); | |||
1058 | return TRUE(!(0)); | |||
1059 | case PANEL_GRAB_OP_RESIZE_UP: | |||
1060 | case PANEL_GRAB_OP_RESIZE_DOWN: | |||
1061 | case PANEL_GRAB_OP_RESIZE_LEFT: | |||
1062 | case PANEL_GRAB_OP_RESIZE_RIGHT: | |||
1063 | panel_toplevel_resize_to_pointer (toplevel, event->x_root, event->y_root); | |||
1064 | return TRUE(!(0)); | |||
1065 | default: | |||
1066 | break; | |||
1067 | } | |||
1068 | ||||
1069 | return FALSE(0); | |||
1070 | } | |||
1071 | ||||
1072 | static void panel_toplevel_calc_floating(PanelToplevel* toplevel) | |||
1073 | { | |||
1074 | CdkRectangle monitor_geom; | |||
1075 | CdkPoint position_on_monitor; | |||
1076 | int snap_tolerance; | |||
1077 | ||||
1078 | if (toplevel->priv->expand) { | |||
1079 | toplevel->priv->floating = FALSE(0); | |||
1080 | return; | |||
1081 | } | |||
1082 | ||||
1083 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1084 | ||||
1085 | if (toplevel->priv->x_right == -1) | |||
1086 | position_on_monitor.x = toplevel->priv->x; | |||
1087 | else | |||
1088 | position_on_monitor.x = monitor_geom.width - (toplevel->priv->x_right + toplevel->priv->geometry.width); | |||
1089 | if (toplevel->priv->y_bottom == -1) | |||
1090 | position_on_monitor.y = toplevel->priv->y; | |||
1091 | else | |||
1092 | position_on_monitor.y = monitor_geom.height - (toplevel->priv->y_bottom + toplevel->priv->geometry.height); | |||
1093 | ||||
1094 | snap_tolerance = toplevel->priv->snap_tolerance; | |||
1095 | ||||
1096 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
1097 | toplevel->priv->floating = | |||
1098 | (position_on_monitor.y > snap_tolerance) && | |||
1099 | (position_on_monitor.y < (monitor_geom.height - toplevel->priv->geometry.height - snap_tolerance)); | |||
1100 | else | |||
1101 | toplevel->priv->floating = | |||
1102 | (position_on_monitor.x > snap_tolerance) && | |||
1103 | (position_on_monitor.x < (monitor_geom.width - toplevel->priv->geometry.width - snap_tolerance)); | |||
1104 | } | |||
1105 | ||||
1106 | void panel_toplevel_push_autohide_disabler(PanelToplevel* toplevel) | |||
1107 | { | |||
1108 | g_return_if_fail (toplevel != NULL)do { if ((toplevel != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel != NULL" ); return; } } while (0); | |||
1109 | ||||
1110 | if (!toplevel->priv->n_autohide_disablers++) | |||
1111 | panel_toplevel_queue_auto_hide (toplevel); | |||
1112 | } | |||
1113 | ||||
1114 | void panel_toplevel_pop_autohide_disabler(PanelToplevel* toplevel) | |||
1115 | { | |||
1116 | g_return_if_fail (toplevel != NULL)do { if ((toplevel != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel != NULL" ); return; } } while (0); | |||
1117 | g_return_if_fail (toplevel->priv->n_autohide_disablers > 0)do { if ((toplevel->priv->n_autohide_disablers > 0)) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char *) (__func__)), "toplevel->priv->n_autohide_disablers > 0" ); return; } } while (0); | |||
1118 | ||||
1119 | if (!--toplevel->priv->n_autohide_disablers) | |||
1120 | panel_toplevel_queue_auto_hide (toplevel); | |||
1121 | } | |||
1122 | ||||
1123 | static gboolean panel_toplevel_get_autohide_disabled(PanelToplevel* toplevel) | |||
1124 | { | |||
1125 | return toplevel->priv->n_autohide_disablers > 0 ? TRUE(!(0)) : FALSE(0); | |||
1126 | } | |||
1127 | ||||
1128 | static gboolean panel_toplevel_hide_button_event(PanelToplevel* toplevel, CdkEventButton* event, CtkButton* button) | |||
1129 | { | |||
1130 | if (event->button == 1) | |||
1131 | return FALSE(0); | |||
1132 | ||||
1133 | return ctk_widget_event (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), (CdkEvent *) event); | |||
1134 | } | |||
1135 | ||||
1136 | static void panel_toplevel_hide_button_clicked(PanelToplevel* toplevel, CtkButton* button) | |||
1137 | { | |||
1138 | CtkArrowType arrow_type; | |||
1139 | gboolean ltr; | |||
1140 | ||||
1141 | if (toplevel->priv->animating || | |||
1142 | toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) | |||
1143 | return; | |||
1144 | ||||
1145 | ltr = ctk_widget_get_direction (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))) == CTK_TEXT_DIR_LTR; | |||
1146 | arrow_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "arrow-type"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), (((GType) ((20) << (2))) ))))), "arrow-type"))); | |||
1147 | ||||
1148 | if (toplevel->priv->state == PANEL_STATE_NORMAL) { | |||
1149 | CtkDirectionType direction = -1; | |||
1150 | ||||
1151 | switch (arrow_type) { | |||
1152 | case CTK_ARROW_UP: | |||
1153 | direction = CTK_DIR_UP; | |||
1154 | break; | |||
1155 | case CTK_ARROW_DOWN: | |||
1156 | direction = CTK_DIR_DOWN; | |||
1157 | break; | |||
1158 | case CTK_ARROW_LEFT: | |||
1159 | direction = ltr ? CTK_DIR_LEFT : CTK_DIR_RIGHT; | |||
1160 | break; | |||
1161 | case CTK_ARROW_RIGHT: | |||
1162 | direction = ltr ? CTK_DIR_RIGHT : CTK_DIR_LEFT; | |||
1163 | break; | |||
1164 | default: | |||
1165 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1165, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1166 | break; | |||
1167 | } | |||
1168 | ||||
1169 | panel_toplevel_hide (toplevel, FALSE(0), direction); | |||
1170 | } else | |||
1171 | panel_toplevel_unhide (toplevel); | |||
1172 | } | |||
1173 | ||||
1174 | static void | |||
1175 | set_arrow_type (CtkImage *image, | |||
1176 | CtkArrowType arrow_type) | |||
1177 | { | |||
1178 | switch (arrow_type) | |||
1179 | { | |||
1180 | case CTK_ARROW_NONE: | |||
1181 | case CTK_ARROW_DOWN: | |||
1182 | ctk_image_set_from_icon_name (image, "pan-down-symbolic", CTK_ICON_SIZE_BUTTON); | |||
1183 | break; | |||
1184 | case CTK_ARROW_UP: | |||
1185 | ctk_image_set_from_icon_name (image, "pan-up-symbolic", CTK_ICON_SIZE_BUTTON); | |||
1186 | break; | |||
1187 | case CTK_ARROW_LEFT: | |||
1188 | ctk_image_set_from_icon_name (image, "pan-start-symbolic", CTK_ICON_SIZE_BUTTON); | |||
1189 | break; | |||
1190 | case CTK_ARROW_RIGHT: | |||
1191 | ctk_image_set_from_icon_name (image, "pan-end-symbolic", CTK_ICON_SIZE_BUTTON); | |||
1192 | break; | |||
1193 | } | |||
1194 | } | |||
1195 | ||||
1196 | static CtkWidget * | |||
1197 | panel_toplevel_add_hide_button (PanelToplevel *toplevel, | |||
1198 | CtkArrowType arrow_type, | |||
1199 | int left, | |||
1200 | int top) | |||
1201 | { | |||
1202 | ||||
1203 | CtkWidget *button; | |||
1204 | AtkObject *obj; | |||
1205 | CtkWidget *arrow; | |||
1206 | ||||
1207 | button = ctk_button_new (); | |||
1208 | obj = ctk_widget_get_accessible (button); | |||
1209 | atk_object_set_name (obj, _("Hide Panel")gettext ("Hide Panel")); | |||
1210 | ctk_widget_set_can_default (button, FALSE(0)); | |||
1211 | ||||
1212 | arrow = ctk_image_new (); | |||
1213 | set_arrow_type (CTK_IMAGE (arrow)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((arrow)), ((ctk_image_get_type ())))))), arrow_type); | |||
1214 | ctk_container_add (CTK_CONTAINER (button)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_container_get_type ())))))), arrow); | |||
1215 | ctk_widget_show (arrow); | |||
1216 | ||||
1217 | g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), (((GType) ((20) << (2)))))))), | |||
1218 | "arrow-type", | |||
1219 | GINT_TO_POINTER (arrow_type)((gpointer) (glong) (arrow_type))); | |||
1220 | ||||
1221 | g_signal_connect_swapped (button, "clicked",g_signal_connect_data ((button), ("clicked"), (((GCallback) ( panel_toplevel_hide_button_clicked))), (toplevel), ((void*)0) , G_CONNECT_SWAPPED) | |||
1222 | G_CALLBACK (panel_toplevel_hide_button_clicked), toplevel)g_signal_connect_data ((button), ("clicked"), (((GCallback) ( panel_toplevel_hide_button_clicked))), (toplevel), ((void*)0) , G_CONNECT_SWAPPED); | |||
1223 | g_signal_connect_swapped (button, "button_press_event",g_signal_connect_data ((button), ("button_press_event"), (((GCallback ) (panel_toplevel_hide_button_event))), (toplevel), ((void*)0 ), G_CONNECT_SWAPPED) | |||
1224 | G_CALLBACK (panel_toplevel_hide_button_event), toplevel)g_signal_connect_data ((button), ("button_press_event"), (((GCallback ) (panel_toplevel_hide_button_event))), (toplevel), ((void*)0 ), G_CONNECT_SWAPPED); | |||
1225 | g_signal_connect_swapped (button, "button_release_event",g_signal_connect_data ((button), ("button_release_event"), (( (GCallback) (panel_toplevel_hide_button_event))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
1226 | G_CALLBACK (panel_toplevel_hide_button_event), toplevel)g_signal_connect_data ((button), ("button_release_event"), (( (GCallback) (panel_toplevel_hide_button_event))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
1227 | ||||
1228 | ctk_grid_attach (CTK_GRID (toplevel->priv->grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->grid)), ((ctk_grid_get_type ())))) )), button, left, top, 1, 1); | |||
1229 | ||||
1230 | return button; | |||
1231 | } | |||
1232 | ||||
1233 | static void panel_toplevel_update_buttons_showing(PanelToplevel* toplevel) | |||
1234 | { | |||
1235 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
1236 | ctk_widget_hide (toplevel->priv->hide_button_top); | |||
1237 | ctk_widget_hide (toplevel->priv->hide_button_bottom); | |||
1238 | ctk_widget_show (toplevel->priv->hide_button_left); | |||
1239 | ctk_widget_show (toplevel->priv->hide_button_right); | |||
1240 | } else { | |||
1241 | ctk_widget_show (toplevel->priv->hide_button_top); | |||
1242 | ctk_widget_show (toplevel->priv->hide_button_bottom); | |||
1243 | ctk_widget_hide (toplevel->priv->hide_button_left); | |||
1244 | ctk_widget_hide (toplevel->priv->hide_button_right); | |||
1245 | } | |||
1246 | ||||
1247 | if (toplevel->priv->attached) { | |||
1248 | switch (panel_toplevel_get_orientation (toplevel->priv->attach_toplevel)) { | |||
1249 | case PANEL_ORIENTATION_TOP: | |||
1250 | ctk_widget_hide (toplevel->priv->hide_button_top); | |||
1251 | break; | |||
1252 | case PANEL_ORIENTATION_BOTTOM: | |||
1253 | ctk_widget_hide (toplevel->priv->hide_button_bottom); | |||
1254 | break; | |||
1255 | case PANEL_ORIENTATION_LEFT: | |||
1256 | ctk_widget_hide (toplevel->priv->hide_button_left); | |||
1257 | break; | |||
1258 | case PANEL_ORIENTATION_RIGHT: | |||
1259 | ctk_widget_hide (toplevel->priv->hide_button_right); | |||
1260 | break; | |||
1261 | default: | |||
1262 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1262, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1263 | break; | |||
1264 | } | |||
1265 | } | |||
1266 | } | |||
1267 | ||||
1268 | /* force set hide button size on panel size < 30px */ | |||
1269 | static void panel_toplevel_update_hide_buttons_size (CtkWidget *button, int panel_size) | |||
1270 | { | |||
1271 | CtkCssProvider *css_provider; | |||
1272 | CtkStyleContext *context; | |||
1273 | CtkWidget *arrow; | |||
1274 | CtkSettings *settings; | |||
1275 | gchar *ctk_theme_name = NULL((void*)0); | |||
1276 | ||||
1277 | context = ctk_widget_get_style_context (button); | |||
1278 | ctk_style_context_add_class (context, "panel-button"); | |||
1279 | ||||
1280 | /* get defaults from theme */ | |||
1281 | settings = ctk_settings_get_default (); | |||
1282 | g_object_get (settings, "ctk-theme-name", &ctk_theme_name, NULL((void*)0)); | |||
1283 | css_provider = ctk_css_provider_get_named (ctk_theme_name, NULL((void*)0)); | |||
1284 | g_free (ctk_theme_name); | |||
1285 | ||||
1286 | /* set custom css by adding our custom code to the default theme css | |||
1287 | * | |||
1288 | * NOTE that contriary to the documentation: | |||
1289 | * https://developer.gnome.org/ctk3/stable/CtkCssProvider.html#ctk-css-provider-load-from-data | |||
1290 | * the previously loaded theme is NOT cleared from the css_provider. (reason unknown) | |||
1291 | * In other words, this works exactly, how we need it here. | |||
1292 | * ALSO NOTE that using ctk_css_provider_to_string () to convert the theme css data into a string | |||
1293 | * and then adding the custom css, then adding this updated css to a css_provider | |||
1294 | * with the ctk_css_provider_load_from_data () also works, | |||
1295 | * however some themes can't be easily converted to strings, beacuse of the binary data | |||
1296 | * they contain. This causes a delay of minutes in loading the cafe-panel, | |||
1297 | * and so this approach is not viable. */ | |||
1298 | if (panel_size < 30) { | |||
1299 | ctk_css_provider_load_from_data (css_provider, ".panel-button {min-height: 13px; min-width: 13px; padding: 0px;}", -1, NULL((void*)0)); | |||
1300 | } | |||
1301 | ||||
1302 | ctk_style_context_add_provider (context, CTK_STYLE_PROVIDER (css_provider)((((CtkStyleProvider*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((css_provider)), ((ctk_style_provider_get_type ())))))), CTK_STYLE_PROVIDER_PRIORITY_APPLICATION600); | |||
1303 | ||||
1304 | /* get arrow image */ | |||
1305 | arrow = ctk_bin_get_child (CTK_BIN (button)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_bin_get_type ()))))))); | |||
1306 | ||||
1307 | /* set image size */ | |||
1308 | if (panel_size < 20) { | |||
1309 | ctk_image_set_pixel_size (CTK_IMAGE (arrow)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((arrow)), ((ctk_image_get_type ())))))), 12); | |||
1310 | } else if (panel_size < 40) { | |||
1311 | ctk_image_set_pixel_size (CTK_IMAGE (arrow)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((arrow)), ((ctk_image_get_type ())))))), 16); | |||
1312 | } else if (panel_size < 60) { | |||
1313 | ctk_image_set_pixel_size (CTK_IMAGE (arrow)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((arrow)), ((ctk_image_get_type ())))))), 22); | |||
1314 | } else { | |||
1315 | ctk_image_set_pixel_size (CTK_IMAGE (arrow)((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((arrow)), ((ctk_image_get_type ())))))), 24); | |||
1316 | } | |||
1317 | } | |||
1318 | ||||
1319 | static void panel_toplevel_update_hide_buttons(PanelToplevel* toplevel) | |||
1320 | { | |||
1321 | ||||
1322 | int panel_size = toplevel->priv->size; | |||
1323 | int hb_size = 0; | |||
1324 | ||||
1325 | if (toplevel->priv->buttons_enabled) { | |||
1326 | panel_toplevel_update_buttons_showing (toplevel); | |||
1327 | ||||
1328 | panel_toplevel_update_hide_buttons_size (toplevel->priv->hide_button_top, panel_size); | |||
1329 | panel_toplevel_update_hide_buttons_size (toplevel->priv->hide_button_bottom, panel_size); | |||
1330 | panel_toplevel_update_hide_buttons_size (toplevel->priv->hide_button_left, panel_size); | |||
1331 | panel_toplevel_update_hide_buttons_size (toplevel->priv->hide_button_right, panel_size); | |||
1332 | ||||
1333 | } else { | |||
1334 | g_object_set ( | |||
1335 | G_OBJECT (toplevel->priv->hide_button_top)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_top)), (((GType) ((20) << (2)))))))), | |||
1336 | "visible", toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN, | |||
1337 | NULL((void*)0)); | |||
1338 | g_object_set ( | |||
1339 | G_OBJECT (toplevel->priv->hide_button_bottom)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_bottom)), (((GType) (( 20) << (2)))))))), | |||
1340 | "visible", toplevel->priv->state == PANEL_STATE_HIDDEN_UP, | |||
1341 | NULL((void*)0)); | |||
1342 | g_object_set ( | |||
1343 | G_OBJECT (toplevel->priv->hide_button_left)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_left)), (((GType) ((20 ) << (2)))))))), | |||
1344 | "visible", toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT, | |||
1345 | NULL((void*)0)); | |||
1346 | g_object_set ( | |||
1347 | G_OBJECT (toplevel->priv->hide_button_right)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_right)), (((GType) ((20 ) << (2)))))))), | |||
1348 | "visible", toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT, | |||
1349 | NULL((void*)0)); | |||
1350 | } | |||
1351 | ||||
1352 | if (toplevel->priv->arrows_enabled) { | |||
1353 | ||||
1354 | ctk_widget_show (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_top)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_top)), ((ctk_bin_get_type ())))))))); | |||
1355 | ctk_widget_show (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_bottom)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_bottom)), ((ctk_bin_get_type ())))))))); | |||
1356 | ctk_widget_show (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_left)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_left)), ((ctk_bin_get_type ())))))))); | |||
1357 | ctk_widget_show (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_right)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_right)), ((ctk_bin_get_type ())))))))); | |||
1358 | ||||
1359 | } else { | |||
1360 | ||||
1361 | ctk_widget_hide (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_top)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_top)), ((ctk_bin_get_type ())))))))); | |||
1362 | ctk_widget_hide (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_bottom)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_bottom)), ((ctk_bin_get_type ())))))))); | |||
1363 | ctk_widget_hide (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_left)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_left)), ((ctk_bin_get_type ())))))))); | |||
1364 | ctk_widget_hide (ctk_bin_get_child (CTK_BIN (toplevel->priv->hide_button_right)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->hide_button_right)), ((ctk_bin_get_type ())))))))); | |||
1365 | } | |||
1366 | ||||
1367 | /* set size after setting the arrow */ | |||
1368 | if (toplevel->priv->buttons_enabled) { | |||
1369 | ||||
1370 | if ( panel_size < 20) { hb_size = 16; } | |||
1371 | else if ( panel_size < 40) { hb_size = 20; } | |||
1372 | else if ( panel_size < 60) { hb_size = 26; } | |||
1373 | else { hb_size = 30; } | |||
1374 | ||||
1375 | ctk_widget_set_size_request (toplevel->priv->hide_button_top, panel_size, hb_size); | |||
1376 | ctk_widget_set_size_request (toplevel->priv->hide_button_bottom, panel_size, hb_size); | |||
1377 | ctk_widget_set_size_request (toplevel->priv->hide_button_left, hb_size, panel_size); | |||
1378 | ctk_widget_set_size_request (toplevel->priv->hide_button_right, hb_size, panel_size); | |||
1379 | } | |||
1380 | } | |||
1381 | ||||
1382 | static gboolean panel_toplevel_contains_pointer(PanelToplevel* toplevel) | |||
1383 | { | |||
1384 | CdkDisplay *display; | |||
1385 | CdkScreen *screen; | |||
1386 | CtkWidget *widget; | |||
1387 | CdkSeat *seat; | |||
1388 | CdkDevice *pointer; | |||
1389 | int x, y; | |||
1390 | ||||
1391 | display = cdk_display_get_default (); | |||
1392 | seat = cdk_display_get_default_seat (display); | |||
1393 | pointer = cdk_seat_get_pointer (seat); | |||
1394 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
1395 | ||||
1396 | if (!ctk_widget_get_realized (widget)) | |||
1397 | return FALSE(0); | |||
1398 | ||||
1399 | screen = NULL((void*)0); | |||
1400 | x = y = -1; | |||
1401 | cdk_device_get_position (pointer, &screen, &x, &y); | |||
1402 | ||||
1403 | if (screen != ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))))) | |||
1404 | return FALSE(0); | |||
1405 | ||||
1406 | if (x == -1 || y == -1) | |||
1407 | return FALSE(0); | |||
1408 | ||||
1409 | if (x < toplevel->priv->geometry.x || x >= (toplevel->priv->geometry.x + toplevel->priv->geometry.width) || | |||
1410 | y < toplevel->priv->geometry.y || y >= (toplevel->priv->geometry.y + toplevel->priv->geometry.height)) | |||
1411 | return FALSE(0); | |||
1412 | ||||
1413 | return TRUE(!(0)); | |||
1414 | } | |||
1415 | ||||
1416 | static inline int panel_toplevel_get_effective_auto_hide_size(PanelToplevel* toplevel) | |||
1417 | { | |||
1418 | int size; | |||
1419 | ||||
1420 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
1421 | size = CLAMP (toplevel->priv->auto_hide_size,(((toplevel->priv->auto_hide_size) > (toplevel->priv ->original_height / 2)) ? (toplevel->priv->original_height / 2) : (((toplevel->priv->auto_hide_size) < (1)) ? ( 1) : (toplevel->priv->auto_hide_size))) | |||
1422 | 1, toplevel->priv->original_height / 2)(((toplevel->priv->auto_hide_size) > (toplevel->priv ->original_height / 2)) ? (toplevel->priv->original_height / 2) : (((toplevel->priv->auto_hide_size) < (1)) ? ( 1) : (toplevel->priv->auto_hide_size))); | |||
1423 | else | |||
1424 | size = CLAMP (toplevel->priv->auto_hide_size,(((toplevel->priv->auto_hide_size) > (toplevel->priv ->original_width / 2)) ? (toplevel->priv->original_width / 2) : (((toplevel->priv->auto_hide_size) < (1)) ? ( 1) : (toplevel->priv->auto_hide_size))) | |||
1425 | 1, toplevel->priv->original_width / 2)(((toplevel->priv->auto_hide_size) > (toplevel->priv ->original_width / 2)) ? (toplevel->priv->original_width / 2) : (((toplevel->priv->auto_hide_size) < (1)) ? ( 1) : (toplevel->priv->auto_hide_size))); | |||
1426 | ||||
1427 | /* paranoia */ | |||
1428 | return (size <= 0) ? DEFAULT_AUTO_HIDE_SIZE1 : size; | |||
1429 | } | |||
1430 | ||||
1431 | static gboolean panel_toplevel_update_struts(PanelToplevel* toplevel, gboolean end_of_animation) | |||
1432 | { | |||
1433 | PanelOrientation orientation; | |||
1434 | gboolean geometry_changed = FALSE(0); | |||
1435 | int strut, strut_start, strut_end; | |||
1436 | int x, y, width, height; | |||
1437 | CdkRectangle monitor_geom; | |||
1438 | ||||
1439 | if (!toplevel->priv->updated_geometry_initial) | |||
1440 | return FALSE(0); | |||
1441 | ||||
1442 | #ifdef HAVE_X111 | |||
1443 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) && toplevel->priv->attached) { | |||
1444 | panel_struts_unregister_strut (toplevel); | |||
1445 | panel_struts_set_window_hint (toplevel); | |||
1446 | return FALSE(0); | |||
1447 | } | |||
1448 | #endif // HAVE_X11 | |||
1449 | ||||
1450 | /* In the case of the initial animation, we really want the struts to | |||
1451 | * represent what is at the end of the animation, to avoid desktop | |||
1452 | * icons jumping around. */ | |||
1453 | if (!toplevel->priv->initial_animation_done) { | |||
1454 | end_of_animation = TRUE(!(0)); | |||
1455 | ||||
1456 | /* We've not started the animation yet, so we have to compute | |||
1457 | * where we want to end. Note that we don't want to compute | |||
1458 | * this everytime, since the struts conflict resolution will be | |||
1459 | * overridden if we do so */ | |||
1460 | if (!toplevel->priv->animating) | |||
1461 | panel_toplevel_calculate_animation_end_geometry (toplevel); | |||
1462 | } | |||
1463 | ||||
1464 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1465 | ||||
1466 | if (end_of_animation) { | |||
1467 | x = toplevel->priv->animation_end_x; | |||
1468 | y = toplevel->priv->animation_end_y; | |||
1469 | x += panel_multimonitor_x (toplevel->priv->monitor); | |||
1470 | y += panel_multimonitor_y (toplevel->priv->monitor); | |||
1471 | if (toplevel->priv->animation_end_width != -1) | |||
1472 | width = toplevel->priv->animation_end_width; | |||
1473 | else | |||
1474 | width = toplevel->priv->geometry.width; | |||
1475 | if (toplevel->priv->animation_end_height != -1) | |||
1476 | height = toplevel->priv->animation_end_height; | |||
1477 | else | |||
1478 | height = toplevel->priv->geometry.height; | |||
1479 | } else { | |||
1480 | x = toplevel->priv->geometry.x; | |||
1481 | y = toplevel->priv->geometry.y; | |||
1482 | width = toplevel->priv->geometry.width; | |||
1483 | height = toplevel->priv->geometry.height; | |||
1484 | } | |||
1485 | ||||
1486 | orientation = toplevel->priv->orientation; | |||
1487 | ||||
1488 | strut = strut_start = strut_end = 0; | |||
1489 | ||||
1490 | if (orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
1491 | if (y <= monitor_geom.y) { | |||
1492 | orientation = PANEL_ORIENTATION_TOP; | |||
1493 | strut = y + height - monitor_geom.y; | |||
1494 | } else if (y >= monitor_geom.y + monitor_geom.height - height) { | |||
1495 | orientation = PANEL_ORIENTATION_BOTTOM; | |||
1496 | strut = monitor_geom.y + monitor_geom.height - y; | |||
1497 | } | |||
1498 | ||||
1499 | if (strut > 0) { | |||
1500 | strut_start = MAX (x, monitor_geom.x)(((x) > (monitor_geom.x)) ? (x) : (monitor_geom.x)); | |||
1501 | strut_end = MIN (x + width, monitor_geom.x + monitor_geom.width)(((x + width) < (monitor_geom.x + monitor_geom.width)) ? ( x + width) : (monitor_geom.x + monitor_geom.width)) - 1; | |||
1502 | } | |||
1503 | } else { | |||
1504 | if (x <= monitor_geom.x) { | |||
1505 | orientation = PANEL_ORIENTATION_LEFT; | |||
1506 | strut = x + width - monitor_geom.x; | |||
1507 | } else if (x >= monitor_geom.x + monitor_geom.width - width) { | |||
1508 | orientation = PANEL_ORIENTATION_RIGHT; | |||
1509 | strut = monitor_geom.x + monitor_geom.width - x; | |||
1510 | } | |||
1511 | ||||
1512 | if (strut > 0) { | |||
1513 | strut_start = MAX (y, monitor_geom.y)(((y) > (monitor_geom.y)) ? (y) : (monitor_geom.y)); | |||
1514 | strut_end = MIN (y + height, monitor_geom.y + monitor_geom.height)(((y + height) < (monitor_geom.y + monitor_geom.height)) ? (y + height) : (monitor_geom.y + monitor_geom.height)) - 1; | |||
1515 | } | |||
1516 | } | |||
1517 | ||||
1518 | /* Adjust strut size based on scale factor */ | |||
1519 | if (strut > 0) | |||
1520 | strut += toplevel->priv->size * (toplevel->priv->scale - 1); | |||
1521 | ||||
1522 | if (orientation != toplevel->priv->orientation) { | |||
1523 | toplevel->priv->orientation = orientation; | |||
1524 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "orientation"); | |||
1525 | } | |||
1526 | ||||
1527 | if (toplevel->priv->auto_hide && strut > 0) | |||
1528 | strut = panel_toplevel_get_effective_auto_hide_size (toplevel); | |||
1529 | ||||
1530 | #ifdef HAVE_X111 | |||
1531 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { | |||
1532 | if (strut > 0) { | |||
1533 | CdkScreen *screen; | |||
1534 | screen = ctk_widget_get_screen (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
1535 | geometry_changed = panel_struts_register_strut (toplevel, | |||
1536 | screen, | |||
1537 | toplevel->priv->monitor, | |||
1538 | orientation, | |||
1539 | strut, | |||
1540 | strut_start, | |||
1541 | strut_end, | |||
1542 | toplevel->priv->scale); | |||
1543 | } | |||
1544 | else { | |||
1545 | panel_struts_unregister_strut (toplevel); | |||
1546 | } | |||
1547 | ||||
1548 | if (toplevel->priv->state == PANEL_STATE_NORMAL || | |||
1549 | toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN || | |||
1550 | toplevel->priv->animating) | |||
1551 | panel_struts_set_window_hint (toplevel); | |||
1552 | else | |||
1553 | panel_struts_unset_window_hint (toplevel); | |||
1554 | } | |||
1555 | #endif // HAVE_X11 | |||
1556 | ||||
1557 | #ifdef HAVE_WAYLAND | |||
1558 | if (CDK_IS_WAYLAND_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))))) { | |||
1559 | wayland_panel_toplevel_update_placement (toplevel); | |||
1560 | } | |||
1561 | #endif // HAVE_WAYLAND | |||
1562 | return geometry_changed; | |||
1563 | } | |||
1564 | ||||
1565 | void panel_toplevel_update_edges(PanelToplevel* toplevel) | |||
1566 | { | |||
1567 | CtkWidget *widget; | |||
1568 | PanelFrameEdge edges; | |||
1569 | PanelFrameEdge inner_edges; | |||
1570 | PanelFrameEdge outer_edges; | |||
1571 | CdkRectangle monitor_geom; | |||
1572 | int width, height; | |||
1573 | gboolean inner_frame = FALSE(0); | |||
1574 | ||||
1575 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
1576 | ||||
1577 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1578 | ||||
1579 | width = toplevel->priv->geometry.width; | |||
1580 | height = toplevel->priv->geometry.height; | |||
1581 | ||||
1582 | edges = PANEL_EDGE_NONE; | |||
1583 | ||||
1584 | /* We don't want any bevels with a color/image background */ | |||
1585 | if (toplevel->priv->geometry.y > 0) | |||
1586 | edges |= PANEL_EDGE_TOP; | |||
1587 | ||||
1588 | if (toplevel->priv->geometry.x > 0) | |||
1589 | edges |= PANEL_EDGE_LEFT; | |||
1590 | ||||
1591 | if (toplevel->priv->geometry.y < (monitor_geom.height - height)) | |||
1592 | edges |= PANEL_EDGE_BOTTOM; | |||
1593 | ||||
1594 | if (toplevel->priv->geometry.x < (monitor_geom.width - width)) | |||
1595 | edges |= PANEL_EDGE_RIGHT; | |||
1596 | ||||
1597 | /* There is a conflict in the position algorithm when a | |||
1598 | * non-expanded centered panel is nearly the size of the | |||
1599 | * screen. This is similar to the one we have in | |||
1600 | * panel_toplevel_update_position(). A simple solution is | |||
1601 | * to keep the bevels in this case. */ | |||
1602 | if (!toplevel->priv->expand && | |||
1603 | toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM) && | |||
1604 | toplevel->priv->x_centered) | |||
1605 | edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; | |||
1606 | ||||
1607 | if (!toplevel->priv->expand && | |||
1608 | toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT) && | |||
1609 | toplevel->priv->y_centered) | |||
1610 | edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; | |||
1611 | ||||
1612 | if (ctk_widget_get_visible (toplevel->priv->hide_button_left) || | |||
1613 | ctk_widget_get_visible (toplevel->priv->hide_button_right)) { | |||
1614 | inner_frame = TRUE(!(0)); | |||
1615 | edges |= PANEL_EDGE_LEFT | PANEL_EDGE_RIGHT; | |||
1616 | } | |||
1617 | ||||
1618 | if (ctk_widget_get_visible (toplevel->priv->hide_button_top) || | |||
1619 | ctk_widget_get_visible (toplevel->priv->hide_button_bottom)) { | |||
1620 | inner_frame = TRUE(!(0)); | |||
1621 | edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; | |||
1622 | } | |||
1623 | ||||
1624 | if (!inner_frame) { | |||
1625 | inner_edges = PANEL_EDGE_NONE; | |||
1626 | outer_edges = edges; | |||
1627 | } else { | |||
1628 | inner_edges = edges; | |||
1629 | outer_edges = PANEL_EDGE_NONE; | |||
1630 | } | |||
1631 | ||||
1632 | panel_frame_set_edges (toplevel->priv->inner_frame, inner_edges); | |||
1633 | ||||
1634 | if (toplevel->priv->edges != outer_edges) { | |||
1635 | toplevel->priv->edges = outer_edges; | |||
1636 | ctk_widget_queue_resize (widget); | |||
1637 | } | |||
1638 | } | |||
1639 | ||||
1640 | static const char* panel_toplevel_construct_description(PanelToplevel *toplevel) | |||
1641 | { | |||
1642 | if (toplevel->priv->attached) | |||
1643 | return _("Drawer")gettext ("Drawer"); | |||
1644 | ||||
1645 | switch (toplevel->priv->orientation) { | |||
1646 | case PANEL_ORIENTATION_TOP: | |||
1647 | /* translators: these string will be shown in MetaCity's switch window | |||
1648 | * popup when you pass the focus to a panel */ | |||
1649 | return _("Top Panel")gettext ("Top Panel"); | |||
1650 | case PANEL_ORIENTATION_BOTTOM: | |||
1651 | return _("Bottom Panel")gettext ("Bottom Panel"); | |||
1652 | case PANEL_ORIENTATION_LEFT: | |||
1653 | return _("Left Panel")gettext ("Left Panel"); | |||
1654 | case PANEL_ORIENTATION_RIGHT: | |||
1655 | return _("Right Panel")gettext ("Right Panel"); | |||
1656 | } | |||
1657 | ||||
1658 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1658, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1659 | return _("Top Panel")gettext ("Top Panel"); | |||
1660 | } | |||
1661 | ||||
1662 | static void panel_toplevel_update_description(PanelToplevel* toplevel) | |||
1663 | { | |||
1664 | const char *description; | |||
1665 | ||||
1666 | description = panel_toplevel_construct_description (toplevel); | |||
1667 | ||||
1668 | if (toplevel->priv->description && | |||
1669 | !strcmp (toplevel->priv->description, description)) | |||
1670 | return; | |||
1671 | ||||
1672 | if (toplevel->priv->description) | |||
1673 | g_free (toplevel->priv->description); | |||
1674 | toplevel->priv->description = g_strdup (description)g_strdup_inline (description); | |||
1675 | ||||
1676 | if (!toplevel->priv->name) | |||
1677 | ctk_window_set_title (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))), | |||
1678 | toplevel->priv->description); | |||
1679 | ||||
1680 | panel_a11y_set_atk_name_desc ( | |||
1681 | CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), | |||
1682 | toplevel->priv->name ? toplevel->priv->name : | |||
1683 | toplevel->priv->description, | |||
1684 | toplevel->priv->description); | |||
1685 | } | |||
1686 | ||||
1687 | static void panel_toplevel_update_attached_position(PanelToplevel* toplevel, gboolean hidden, int* x, int* y, int* w, int* h) | |||
1688 | { | |||
1689 | CtkAllocation attach_allocation; | |||
1690 | PanelOrientation attach_orientation; | |||
1691 | CdkRectangle toplevel_box; | |||
1692 | CdkRectangle parent_box; | |||
1693 | CdkRectangle attach_box; | |||
1694 | int x_origin = 0, y_origin = 0; | |||
1695 | CdkRectangle monitor_geom; | |||
1696 | ||||
1697 | if (!ctk_widget_get_realized (CTK_WIDGET (toplevel->priv->attach_toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->attach_toplevel)), ((ctk_widget_get_type ()))))))) || | |||
1698 | !ctk_widget_get_realized (toplevel->priv->attach_widget)) | |||
1699 | return; | |||
1700 | ||||
1701 | ctk_widget_get_allocation (CTK_WIDGET (toplevel->priv->attach_widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->attach_widget)), ((ctk_widget_get_type ())))))), &attach_allocation); | |||
1702 | ||||
1703 | toplevel_box = toplevel->priv->geometry; | |||
1704 | parent_box = toplevel->priv->attach_toplevel->priv->geometry; | |||
1705 | attach_box = attach_allocation; | |||
1706 | ||||
1707 | if (attach_box.x != -1) { | |||
1708 | cdk_window_get_origin (ctk_widget_get_window (CTK_WIDGET (toplevel->priv->attach_widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->attach_widget)), ((ctk_widget_get_type ()))))))), | |||
1709 | &x_origin, &y_origin); | |||
1710 | ||||
1711 | attach_box.x += x_origin; | |||
1712 | attach_box.y += y_origin; | |||
1713 | } else { | |||
1714 | /* attach_widget isn't allocated. Put the toplevel | |||
1715 | * off screen. | |||
1716 | */ | |||
1717 | attach_box.x = -toplevel_box.width; | |||
1718 | attach_box.y = -toplevel_box.height; | |||
1719 | } | |||
1720 | ||||
1721 | attach_orientation = panel_toplevel_get_orientation ( | |||
1722 | toplevel->priv->attach_toplevel); | |||
1723 | ||||
1724 | if (attach_orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
1725 | *x = attach_box.x + attach_box.width / 2 - toplevel_box.width / 2; | |||
1726 | else | |||
1727 | *y = attach_box.y + attach_box.height / 2 - toplevel_box.height / 2; | |||
1728 | ||||
1729 | switch (attach_orientation) { | |||
1730 | case PANEL_ORIENTATION_TOP: | |||
1731 | *y = parent_box.y; | |||
1732 | if (!hidden) | |||
1733 | *y += parent_box.height; | |||
1734 | else | |||
1735 | *h = parent_box.height; | |||
1736 | break; | |||
1737 | case PANEL_ORIENTATION_BOTTOM: | |||
1738 | *y = parent_box.y; | |||
1739 | if (!hidden) | |||
1740 | *y -= toplevel_box.height; | |||
1741 | else | |||
1742 | *h = parent_box.height; | |||
1743 | break; | |||
1744 | case PANEL_ORIENTATION_LEFT: | |||
1745 | *x = parent_box.x; | |||
1746 | if (!hidden) | |||
1747 | *x += parent_box.width; | |||
1748 | else | |||
1749 | *w = parent_box.width; | |||
1750 | break; | |||
1751 | case PANEL_ORIENTATION_RIGHT: | |||
1752 | *x = parent_box.x; | |||
1753 | if (!hidden) | |||
1754 | *x -= toplevel_box.width; | |||
1755 | else | |||
1756 | *w = parent_box.width; | |||
1757 | break; | |||
1758 | default: | |||
1759 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1759, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1760 | break; | |||
1761 | } | |||
1762 | ||||
1763 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1764 | ||||
1765 | *x -= monitor_geom.x; | |||
1766 | *y -= monitor_geom.y; | |||
1767 | ||||
1768 | if (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
1769 | *x = CLAMP (*x, 0, monitor_geom.width - toplevel->priv->original_width)(((*x) > (monitor_geom.width - toplevel->priv->original_width )) ? (monitor_geom.width - toplevel->priv->original_width ) : (((*x) < (0)) ? (0) : (*x))); | |||
1770 | else | |||
1771 | *y = CLAMP (*y, 0, monitor_geom.height - toplevel->priv->original_height)(((*y) > (monitor_geom.height - toplevel->priv->original_height )) ? (monitor_geom.height - toplevel->priv->original_height ) : (((*y) < (0)) ? (0) : (*y))); | |||
1772 | } | |||
1773 | ||||
1774 | static void panel_toplevel_update_normal_position(PanelToplevel* toplevel, int* x, int* y, int* w, int* h) | |||
1775 | { | |||
1776 | CdkRectangle monitor_geom; | |||
1777 | int width, height; | |||
1778 | int snap_tolerance; | |||
1779 | ||||
1780 | g_assert (x != NULL && y != NULL)do { if (x != ((void*)0) && y != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1780, ((const char*) (__func__ )), "x != NULL && y != NULL"); } while (0); | |||
1781 | ||||
1782 | if (toplevel->priv->attached) { | |||
1783 | panel_toplevel_update_attached_position (toplevel, FALSE(0), x, y, w, h); | |||
1784 | return; | |||
1785 | } | |||
1786 | ||||
1787 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1788 | ||||
1789 | width = toplevel->priv->original_width; | |||
1790 | height = toplevel->priv->original_height; | |||
1791 | snap_tolerance = toplevel->priv->snap_tolerance; | |||
1792 | ||||
1793 | *x = CLAMP (*x, 0, monitor_geom.width - width)(((*x) > (monitor_geom.width - width)) ? (monitor_geom.width - width) : (((*x) < (0)) ? (0) : (*x))); | |||
1794 | *y = CLAMP (*y, 0, monitor_geom.height - height)(((*y) > (monitor_geom.height - height)) ? (monitor_geom.height - height) : (((*y) < (0)) ? (0) : (*y))); | |||
1795 | ||||
1796 | if (toplevel->priv->x <= snap_tolerance && | |||
1797 | toplevel->priv->x_right == -1 && | |||
1798 | !toplevel->priv->x_centered) | |||
1799 | *x = 0; | |||
1800 | else if (toplevel->priv->x_right != -1 && | |||
1801 | toplevel->priv->x_right <= snap_tolerance && | |||
1802 | !toplevel->priv->x_centered) | |||
1803 | *x = monitor_geom.width - width; | |||
1804 | ||||
1805 | if (toplevel->priv->y <= snap_tolerance && | |||
1806 | toplevel->priv->y_bottom == -1 && | |||
1807 | !toplevel->priv->y_centered) | |||
1808 | *y = 0; | |||
1809 | else if (toplevel->priv->y_bottom != -1 && | |||
1810 | toplevel->priv->y_bottom <= snap_tolerance && | |||
1811 | !toplevel->priv->y_centered) | |||
1812 | *y = monitor_geom.height - height; | |||
1813 | } | |||
1814 | ||||
1815 | static void | |||
1816 | panel_toplevel_update_auto_hide_position (PanelToplevel *toplevel, | |||
1817 | int *x, | |||
1818 | int *y, | |||
1819 | int *w, | |||
1820 | int *h, | |||
1821 | gboolean for_end_position) | |||
1822 | { | |||
1823 | int width, height; | |||
1824 | CdkRectangle monitor_geom; | |||
1825 | int auto_hide_size; | |||
1826 | int snap_tolerance; | |||
1827 | ||||
1828 | g_assert (x != NULL && y != NULL)do { if (x != ((void*)0) && y != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1828, ((const char*) (__func__ )), "x != NULL && y != NULL"); } while (0); | |||
1829 | ||||
1830 | if (toplevel->priv->floating) { | |||
1831 | panel_toplevel_update_normal_position (toplevel, x, y, w, h); | |||
1832 | return; | |||
1833 | } | |||
1834 | ||||
1835 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1836 | ||||
1837 | width = toplevel->priv->original_width; | |||
1838 | height = toplevel->priv->original_height; | |||
1839 | snap_tolerance = toplevel->priv->snap_tolerance; | |||
1840 | ||||
1841 | /* For the initial animation, we anicafe from outside the screen, and | |||
1842 | * so we don't want the toplevel to be visible at all. But when the | |||
1843 | * request is for the end position, then we give the real result (it's | |||
1844 | * useful for struts) */ | |||
1845 | if (for_end_position || toplevel->priv->initial_animation_done) { | |||
1846 | auto_hide_size = panel_toplevel_get_effective_auto_hide_size (toplevel); | |||
1847 | } else { | |||
1848 | auto_hide_size = 0; | |||
1849 | } | |||
1850 | ||||
1851 | switch (toplevel->priv->orientation) { | |||
1852 | case PANEL_ORIENTATION_TOP: | |||
1853 | *y = - (height - auto_hide_size); | |||
1854 | break; | |||
1855 | case PANEL_ORIENTATION_BOTTOM: | |||
1856 | *y = monitor_geom.height - auto_hide_size; | |||
1857 | break; | |||
1858 | case PANEL_ORIENTATION_LEFT: | |||
1859 | *x = - (width - auto_hide_size); | |||
1860 | break; | |||
1861 | case PANEL_ORIENTATION_RIGHT: | |||
1862 | *x = monitor_geom.width - auto_hide_size; | |||
1863 | break; | |||
1864 | default: | |||
1865 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1865, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1866 | break; | |||
1867 | } | |||
1868 | ||||
1869 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
1870 | if (toplevel->priv->x <= snap_tolerance && | |||
1871 | toplevel->priv->x_right == -1 && | |||
1872 | !toplevel->priv->x_centered) | |||
1873 | *x = 0; | |||
1874 | else if (toplevel->priv->x_right != -1 && | |||
1875 | toplevel->priv->x_right <= snap_tolerance && | |||
1876 | !toplevel->priv->x_centered) | |||
1877 | *x = monitor_geom.width - width; | |||
1878 | } else /* if (toplevel->priv->orientation & PANEL_VERTICAL_MASK) */ { | |||
1879 | if (toplevel->priv->y <= snap_tolerance && | |||
1880 | toplevel->priv->y_bottom == -1 && | |||
1881 | !toplevel->priv->y_centered) | |||
1882 | *y = 0; | |||
1883 | else if (toplevel->priv->y_bottom != -1 && | |||
1884 | toplevel->priv->y_bottom <= snap_tolerance && | |||
1885 | !toplevel->priv->y_centered) | |||
1886 | *y = monitor_geom.height - height; | |||
1887 | } | |||
1888 | } | |||
1889 | ||||
1890 | /* FIXME: this is wrong for Xinerama. In the Xinerama case | |||
1891 | * I think if hiding it requires it to go onto the | |||
1892 | * next monitor then it should just move it on to | |||
1893 | * the next monitor and set its state back to normal | |||
1894 | */ | |||
1895 | static void | |||
1896 | panel_toplevel_update_hidden_position (PanelToplevel *toplevel, | |||
1897 | int *x, | |||
1898 | int *y, | |||
1899 | int *w, | |||
1900 | int *h) | |||
1901 | { | |||
1902 | int width, height; | |||
1903 | int min_hide_size; | |||
1904 | CdkRectangle monitor_geom; | |||
1905 | CtkAllocation hide_allocation; | |||
1906 | ||||
1907 | g_assert (x != NULL && y != NULL)do { if (x != ((void*)0) && y != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1907, ((const char*) (__func__ )), "x != NULL && y != NULL"); } while (0); | |||
1908 | ||||
1909 | g_assert (toplevel->priv->state == PANEL_STATE_HIDDEN_UP ||do { if (toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel ->priv->state == PANEL_STATE_HIDDEN_RIGHT) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1912, ((const char*) (__func__ )), "toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT" ); } while (0) | |||
1910 | toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN ||do { if (toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel ->priv->state == PANEL_STATE_HIDDEN_RIGHT) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1912, ((const char*) (__func__ )), "toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT" ); } while (0) | |||
1911 | toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT ||do { if (toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel ->priv->state == PANEL_STATE_HIDDEN_RIGHT) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1912, ((const char*) (__func__ )), "toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT" ); } while (0) | |||
1912 | toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT)do { if (toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel ->priv->state == PANEL_STATE_HIDDEN_RIGHT) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 1912, ((const char*) (__func__ )), "toplevel->priv->state == PANEL_STATE_HIDDEN_UP || toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT" ); } while (0); | |||
1913 | ||||
1914 | if (toplevel->priv->attached) { | |||
1915 | panel_toplevel_update_attached_position (toplevel, TRUE(!(0)), x, y, w, h); | |||
1916 | return; | |||
1917 | } | |||
1918 | ||||
1919 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
1920 | ||||
1921 | width = toplevel->priv->original_width; | |||
1922 | height = toplevel->priv->original_height; | |||
1923 | ||||
1924 | //FIXME should find a better default | |||
1925 | min_hide_size = DEFAULT_AUTO_HIDE_SIZE1; | |||
1926 | ||||
1927 | switch (toplevel->priv->state) { | |||
1928 | case PANEL_STATE_HIDDEN_UP: | |||
1929 | ctk_widget_get_allocation (toplevel->priv->hide_button_bottom, | |||
1930 | &hide_allocation); | |||
1931 | *y = - (height - MAX (hide_allocation.height, min_hide_size)(((hide_allocation.height) > (min_hide_size)) ? (hide_allocation .height) : (min_hide_size))); | |||
1932 | break; | |||
1933 | case PANEL_STATE_HIDDEN_DOWN: | |||
1934 | ctk_widget_get_allocation (toplevel->priv->hide_button_top, | |||
1935 | &hide_allocation); | |||
1936 | *y = monitor_geom.height - MAX (hide_allocation.height, min_hide_size)(((hide_allocation.height) > (min_hide_size)) ? (hide_allocation .height) : (min_hide_size)); | |||
1937 | break; | |||
1938 | case PANEL_STATE_HIDDEN_LEFT: | |||
1939 | ctk_widget_get_allocation (toplevel->priv->hide_button_right, | |||
1940 | &hide_allocation); | |||
1941 | *x = - (width - MAX (hide_allocation.width, min_hide_size)(((hide_allocation.width) > (min_hide_size)) ? (hide_allocation .width) : (min_hide_size))); | |||
1942 | break; | |||
1943 | case PANEL_STATE_HIDDEN_RIGHT: | |||
1944 | ctk_widget_get_allocation (toplevel->priv->hide_button_left, | |||
1945 | &hide_allocation); | |||
1946 | *x = monitor_geom.width - MAX (hide_allocation.width, min_hide_size)(((hide_allocation.width) > (min_hide_size)) ? (hide_allocation .width) : (min_hide_size)); | |||
1947 | break; | |||
1948 | default: | |||
1949 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 1949, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
1950 | break; | |||
1951 | } | |||
1952 | } | |||
1953 | ||||
1954 | /* | |||
1955 | * This is "almost" like the double sine movement | |||
1956 | * from the original panel except that it uses | |||
1957 | * a cubic (twice again). I suppose it looks less | |||
1958 | * mathematical now :) -- _v_ | |||
1959 | */ | |||
1960 | static int | |||
1961 | get_delta (int src, | |||
1962 | int dest, | |||
1963 | GTimeVal *start_time, | |||
1964 | GTimeVal *end_time, | |||
1965 | GTimeVal *cur_time) | |||
1966 | { | |||
1967 | double x, s, n, d, percentage; | |||
1968 | ||||
1969 | s = start_time->tv_sec + ((double)start_time->tv_usec / G_USEC_PER_SEC1000000); | |||
1970 | n = cur_time->tv_sec + ((double)cur_time->tv_usec / G_USEC_PER_SEC1000000); | |||
1971 | d = end_time->tv_sec + ((double)end_time->tv_usec / G_USEC_PER_SEC1000000); | |||
1972 | ||||
1973 | n -= s; | |||
1974 | d -= s; | |||
1975 | ||||
1976 | if (abs (dest - src) <= 1 || n >= d) | |||
1977 | return dest - src; | |||
1978 | ||||
1979 | /* The cubic is: p(x) = (-2) x^2 (x-1.5) */ | |||
1980 | /* running p(p(x)) to make it more "pronounced", | |||
1981 | * effectively making it a ninth-degree polynomial */ | |||
1982 | ||||
1983 | x = (double)n/d; | |||
1984 | x = -2 * (x*x) * (x-1.5); | |||
1985 | /* run it again */ | |||
1986 | percentage = -2 * (x*x) * (x-1.5); | |||
1987 | ||||
1988 | percentage = CLAMP (percentage, 0.0, 1.0)(((percentage) > (1.0)) ? (1.0) : (((percentage) < (0.0 )) ? (0.0) : (percentage))); | |||
1989 | ||||
1990 | return ((dest - src) * percentage); | |||
1991 | } | |||
1992 | ||||
1993 | static void | |||
1994 | panel_toplevel_update_animating_position (PanelToplevel *toplevel) | |||
1995 | { | |||
1996 | GTimeVal time_val; | |||
1997 | int deltax, deltay, deltaw = 0, deltah = 0; | |||
1998 | int monitor_offset_x, monitor_offset_y; | |||
1999 | ||||
2000 | g_get_current_time (&time_val); | |||
2001 | ||||
2002 | monitor_offset_x = panel_multimonitor_x (toplevel->priv->monitor); | |||
2003 | monitor_offset_y = panel_multimonitor_y (toplevel->priv->monitor); | |||
2004 | ||||
2005 | if (toplevel->priv->animation_end_width != -1) | |||
2006 | deltaw = get_delta (toplevel->priv->geometry.width, | |||
2007 | toplevel->priv->animation_end_width, | |||
2008 | &toplevel->priv->animation_start_time, | |||
2009 | &toplevel->priv->animation_end_time, | |||
2010 | &time_val); | |||
2011 | ||||
2012 | if (toplevel->priv->animation_end_height != -1) | |||
2013 | deltah = get_delta (toplevel->priv->geometry.height, | |||
2014 | toplevel->priv->animation_end_height, | |||
2015 | &toplevel->priv->animation_start_time, | |||
2016 | &toplevel->priv->animation_end_time, | |||
2017 | &time_val); | |||
2018 | ||||
2019 | deltax = get_delta (toplevel->priv->geometry.x - monitor_offset_x, | |||
2020 | toplevel->priv->animation_end_x, | |||
2021 | &toplevel->priv->animation_start_time, | |||
2022 | &toplevel->priv->animation_end_time, | |||
2023 | &time_val); | |||
2024 | ||||
2025 | deltay = get_delta (toplevel->priv->geometry.y - monitor_offset_y, | |||
2026 | toplevel->priv->animation_end_y, | |||
2027 | &toplevel->priv->animation_start_time, | |||
2028 | &toplevel->priv->animation_end_time, | |||
2029 | &time_val); | |||
2030 | ||||
2031 | if (deltaw != 0 && abs (deltaw) > abs (deltax)) | |||
2032 | deltax = deltaw; | |||
2033 | if (deltah != 0 && abs (deltah) > abs (deltay)) | |||
2034 | deltay = deltah; | |||
2035 | ||||
2036 | toplevel->priv->geometry.x += deltax; | |||
2037 | toplevel->priv->geometry.y += deltay; | |||
2038 | ||||
2039 | toplevel->priv->geometry.width += deltaw; | |||
2040 | toplevel->priv->geometry.height += deltah; | |||
2041 | ||||
2042 | if (toplevel->priv->geometry.x - monitor_offset_x == toplevel->priv->animation_end_x && | |||
2043 | toplevel->priv->geometry.y - monitor_offset_y == toplevel->priv->animation_end_y) { | |||
2044 | toplevel->priv->animating = FALSE(0); | |||
2045 | /* Note: it's important to set initial_animation_done to TRUE | |||
2046 | * as soon as possible (hence, here) since we don't want to | |||
2047 | * have a wrong value in a size request event */ | |||
2048 | toplevel->priv->initial_animation_done = TRUE(!(0)); | |||
2049 | ||||
2050 | if (toplevel->priv->attached && panel_toplevel_get_is_hidden (toplevel)) | |||
2051 | ctk_widget_unmap (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2052 | else | |||
2053 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2054 | ||||
2055 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
2056 | g_signal_emit (toplevel, toplevel_signals [UNHIDE_SIGNAL], 0); | |||
2057 | } | |||
2058 | } | |||
2059 | ||||
2060 | static void | |||
2061 | panel_toplevel_update_expanded_position (PanelToplevel *toplevel) | |||
2062 | { | |||
2063 | CdkRectangle monitor_geom; | |||
2064 | int x, y; | |||
2065 | int x_right, y_bottom; | |||
2066 | int monitor; | |||
2067 | ||||
2068 | if (!toplevel->priv->expand) | |||
2069 | return; | |||
2070 | ||||
2071 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
2072 | ||||
2073 | x = -1; | |||
2074 | y = -1; | |||
2075 | x_right = -1; | |||
2076 | y_bottom = -1; | |||
2077 | ||||
2078 | switch (toplevel->priv->orientation) { | |||
2079 | case PANEL_ORIENTATION_TOP: | |||
2080 | x = monitor_geom.x; | |||
2081 | y = monitor_geom.y; | |||
2082 | break; | |||
2083 | case PANEL_ORIENTATION_LEFT: | |||
2084 | x = monitor_geom.x; | |||
2085 | y = monitor_geom.y; | |||
2086 | break; | |||
2087 | case PANEL_ORIENTATION_BOTTOM: | |||
2088 | x = monitor_geom.x; | |||
2089 | y = monitor_geom.y + monitor_geom.height - toplevel->priv->geometry.height; | |||
2090 | y_bottom = 0; | |||
2091 | break; | |||
2092 | case PANEL_ORIENTATION_RIGHT: | |||
2093 | x = monitor_geom.x + monitor_geom.width - toplevel->priv->geometry.width; | |||
2094 | y = monitor_geom.y; | |||
2095 | x_right = 0; | |||
2096 | break; | |||
2097 | default: | |||
2098 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 2098, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
2099 | break; | |||
2100 | } | |||
2101 | ||||
2102 | monitor = panel_multimonitor_get_monitor_at_point (x, y); | |||
2103 | ||||
2104 | panel_toplevel_set_monitor_internal (toplevel, monitor, TRUE(!(0))); | |||
2105 | ||||
2106 | x -= panel_multimonitor_x (monitor); | |||
2107 | y -= panel_multimonitor_y (monitor); | |||
2108 | ||||
2109 | g_object_freeze_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
2110 | ||||
2111 | if (toplevel->priv->x != x) { | |||
2112 | toplevel->priv->x = x; | |||
2113 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x"); | |||
2114 | } | |||
2115 | ||||
2116 | if (toplevel->priv->y != y) { | |||
2117 | toplevel->priv->y = y; | |||
2118 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y"); | |||
2119 | } | |||
2120 | ||||
2121 | if (toplevel->priv->x_right != x_right) { | |||
2122 | toplevel->priv->x_right = x_right; | |||
2123 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x_right"); | |||
2124 | } | |||
2125 | ||||
2126 | if (toplevel->priv->y_bottom != y_bottom) { | |||
2127 | toplevel->priv->y_bottom = y_bottom; | |||
2128 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y_bottom"); | |||
2129 | } | |||
2130 | ||||
2131 | g_object_thaw_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
2132 | } | |||
2133 | ||||
2134 | static void | |||
2135 | panel_toplevel_update_position (PanelToplevel *toplevel) | |||
2136 | { | |||
2137 | PanelBackground *background; | |||
2138 | int x, y; | |||
2139 | int w, h; | |||
2140 | CdkRectangle monitor_geom; | |||
2141 | ||||
2142 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
2143 | ||||
2144 | if (toplevel->priv->animating) { | |||
2145 | panel_toplevel_update_animating_position (toplevel); | |||
2146 | return; | |||
2147 | } | |||
2148 | ||||
2149 | if (toplevel->priv->position_centered) { | |||
2150 | toplevel->priv->position_centered = FALSE(0); | |||
2151 | ||||
2152 | g_object_freeze_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
2153 | ||||
2154 | if (!toplevel->priv->x_centered) { | |||
2155 | int x_right; | |||
2156 | ||||
2157 | toplevel->priv->x -= toplevel->priv->geometry.width / 2; | |||
2158 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x"); | |||
2159 | ||||
2160 | if ((toplevel->priv->x + toplevel->priv->geometry.width / 2) > monitor_geom.width / 2) | |||
2161 | x_right = monitor_geom.width - (toplevel->priv->x + toplevel->priv->geometry.width); | |||
2162 | else | |||
2163 | x_right = -1; | |||
2164 | if (toplevel->priv->x_right != x_right) { | |||
2165 | toplevel->priv->x_right = x_right; | |||
2166 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), | |||
2167 | "x-right"); | |||
2168 | } | |||
2169 | } | |||
2170 | ||||
2171 | if (!toplevel->priv->y_centered) { | |||
2172 | int y_bottom; | |||
2173 | ||||
2174 | toplevel->priv->y -= toplevel->priv->geometry.height / 2; | |||
2175 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y"); | |||
2176 | ||||
2177 | if ((toplevel->priv->y + toplevel->priv->geometry.height / 2) > monitor_geom.height / 2) | |||
2178 | y_bottom = monitor_geom.height - (toplevel->priv->y + toplevel->priv->geometry.height); | |||
2179 | else | |||
2180 | y_bottom = -1; | |||
2181 | if (toplevel->priv->y_bottom != y_bottom) { | |||
2182 | toplevel->priv->y_bottom = y_bottom; | |||
2183 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), | |||
2184 | "y-bottom"); | |||
2185 | } | |||
2186 | } | |||
2187 | ||||
2188 | g_object_thaw_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
2189 | } | |||
2190 | ||||
2191 | panel_toplevel_update_expanded_position (toplevel); | |||
2192 | panel_toplevel_calc_floating (toplevel); //FIXME should probably be done after panel_toplevel_update_normal_position() too | |||
2193 | ||||
2194 | if (toplevel->priv->x_right == -1) | |||
2195 | x = toplevel->priv->x; | |||
2196 | else | |||
2197 | x = monitor_geom.width - (toplevel->priv->x_right + toplevel->priv->geometry.width); | |||
2198 | if (toplevel->priv->y_bottom == -1) | |||
2199 | y = toplevel->priv->y; | |||
2200 | else | |||
2201 | y = monitor_geom.height - (toplevel->priv->y_bottom + toplevel->priv->geometry.height); | |||
2202 | ||||
2203 | if (!toplevel->priv->expand) { | |||
2204 | if (toplevel->priv->x_centered) | |||
2205 | x = (monitor_geom.width - toplevel->priv->geometry.width) / 2; | |||
2206 | if (toplevel->priv->y_centered) | |||
2207 | y = (monitor_geom.height - toplevel->priv->geometry.height) / 2; | |||
2208 | } | |||
2209 | ||||
2210 | w = h = -1; | |||
2211 | ||||
2212 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
2213 | panel_toplevel_update_normal_position (toplevel, &x, &y, &w, &h); | |||
2214 | ||||
2215 | else if (toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) | |||
2216 | panel_toplevel_update_auto_hide_position (toplevel, &x, &y, &w, &h, FALSE(0)); | |||
2217 | ||||
2218 | else | |||
2219 | panel_toplevel_update_hidden_position (toplevel, &x, &y, &w, &h); | |||
2220 | ||||
2221 | if (w != -1) | |||
2222 | toplevel->priv->geometry.width = w; | |||
2223 | if (h != -1) | |||
2224 | toplevel->priv->geometry.height = h; | |||
2225 | ||||
2226 | /* This is some kind of snap: there's a possibility of an infinite loop | |||
2227 | * because of the bevels of the frame that are set in | |||
2228 | * panel_toplevel_update_edges(). The bevels change the width/height of | |||
2229 | * the toplevel. The typical loop is: | |||
2230 | * x = 1 => outer bevel => x = 0 => no outer bevel = > x = 1 => ... | |||
2231 | * FIXME: maybe the real bug is that we enter into this loop (see bug | |||
2232 | * #160748 to learn how to reproduce.) */ | |||
2233 | background = &toplevel->background; | |||
2234 | ||||
2235 | /* There's no bevels with a color/image background */ | |||
2236 | if (panel_background_effective_type (background) == PANEL_BACK_NONE) { | |||
2237 | CtkStyleContext *context; | |||
2238 | CtkStateFlags state; | |||
2239 | CdkRectangle *geometry; | |||
2240 | CtkBorder padding; | |||
2241 | int max_size; | |||
2242 | ||||
2243 | state = ctk_widget_get_state_flags (CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ()))))))); | |||
2244 | context = ctk_widget_get_style_context (CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ()))))))); | |||
2245 | ctk_style_context_get_padding (context, state, &padding); | |||
2246 | geometry = &toplevel->priv->geometry; | |||
2247 | ||||
2248 | if (x <= padding.left && x > 0 && | |||
2249 | !toplevel->priv->x_centered) | |||
2250 | x = 0; | |||
2251 | ||||
2252 | if (y <= padding.top && y > 0 && | |||
2253 | !toplevel->priv->y_centered) | |||
2254 | y = 0; | |||
2255 | ||||
2256 | max_size = monitor_geom.width - geometry->width - padding.right; | |||
2257 | if (x + padding.left >= max_size && x < max_size && | |||
2258 | !toplevel->priv->x_centered) | |||
2259 | x = max_size; | |||
2260 | ||||
2261 | max_size = monitor_geom.height - geometry->height - padding.bottom; | |||
2262 | if (y + padding.top >= max_size && y < max_size && | |||
2263 | !toplevel->priv->y_centered) | |||
2264 | y = max_size; | |||
2265 | } | |||
2266 | ||||
2267 | x += panel_multimonitor_x (toplevel->priv->monitor); | |||
2268 | y += panel_multimonitor_y (toplevel->priv->monitor); | |||
2269 | ||||
2270 | toplevel->priv->geometry.x = x; | |||
2271 | toplevel->priv->geometry.y = y; | |||
2272 | } | |||
2273 | ||||
2274 | static int | |||
2275 | calculate_minimum_height (CtkWidget *widget, | |||
2276 | PanelOrientation orientation) | |||
2277 | { | |||
2278 | CtkStateFlags state; | |||
2279 | CtkStyleContext *style_context; | |||
2280 | PangoFontDescription *font_desc; | |||
2281 | CtkBorder padding; | |||
2282 | PangoContext *pango_context; | |||
2283 | PangoFontMetrics *metrics; | |||
2284 | int ascent; | |||
2285 | int descent; | |||
2286 | int thickness; | |||
2287 | ||||
2288 | state = ctk_widget_get_state_flags (widget); | |||
2289 | style_context = ctk_widget_get_style_context (widget); | |||
2290 | ctk_style_context_get(style_context, state, CTK_STYLE_PROPERTY_FONT"font", &font_desc, NULL((void*)0)); | |||
2291 | ||||
2292 | pango_context = ctk_widget_get_pango_context (widget); | |||
2293 | metrics = pango_context_get_metrics (pango_context, | |||
2294 | font_desc, | |||
2295 | pango_context_get_language (pango_context)); | |||
2296 | ctk_style_context_get_padding (style_context, state, &padding); | |||
2297 | ||||
2298 | ascent = pango_font_metrics_get_ascent (metrics); | |||
2299 | descent = pango_font_metrics_get_descent (metrics); | |||
2300 | ||||
2301 | pango_font_description_free (font_desc); | |||
2302 | pango_font_metrics_unref (metrics); | |||
2303 | ||||
2304 | thickness = (orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) ? | |||
2305 | padding.top + padding.bottom : | |||
2306 | padding.left + padding.right; | |||
2307 | ||||
2308 | return PANGO_PIXELS (ascent + descent)(((int)(ascent + descent) + 512) >> 10) + thickness; | |||
2309 | } | |||
2310 | ||||
2311 | static int | |||
2312 | panel_toplevel_update_size_from_hints (PanelToplevel *toplevel, | |||
2313 | int requisition_size, | |||
2314 | int monitor_size, | |||
2315 | int non_panel_widget_size) | |||
2316 | { | |||
2317 | int nb_size_hints; | |||
2318 | AppletSizeHints *applets_hints; | |||
2319 | AppletSizeHintsAlloc *using_hint; | |||
2320 | ||||
2321 | int i; | |||
2322 | int total_size; | |||
2323 | int full_hints; | |||
2324 | ||||
2325 | /* Scale down the size so that the panel only takes what it needs for the applets it has. */ | |||
2326 | total_size = non_panel_widget_size + (requisition_size / toplevel->priv->scale); | |||
2327 | ||||
2328 | nb_size_hints = toplevel->priv->panel_widget->nb_applets_size_hints; | |||
2329 | if (nb_size_hints <= 0) | |||
2330 | return total_size; | |||
2331 | ||||
2332 | applets_hints = toplevel->priv->panel_widget->applets_hints; | |||
2333 | using_hint = toplevel->priv->panel_widget->applets_using_hint; | |||
2334 | ||||
2335 | for (i = 0; i < nb_size_hints; i++) { | |||
2336 | using_hint[i].index = applets_hints[i].len - 2; | |||
2337 | using_hint[i].size = applets_hints[i].hints[applets_hints[i].len - 1]; | |||
2338 | total_size += using_hint[i].size; | |||
2339 | } | |||
2340 | ||||
2341 | if (total_size > monitor_size) | |||
2342 | return monitor_size; | |||
2343 | ||||
2344 | full_hints = 0; | |||
2345 | while (full_hints != nb_size_hints && total_size < monitor_size) { | |||
2346 | int bonus; | |||
2347 | int extra_bonus; | |||
2348 | ||||
2349 | bonus = (monitor_size - total_size) | |||
2350 | / (nb_size_hints - full_hints); | |||
2351 | extra_bonus = (monitor_size - total_size) | |||
2352 | % (nb_size_hints - full_hints); | |||
2353 | full_hints = 0; | |||
2354 | ||||
2355 | for (i = 0; i < nb_size_hints; i++) { | |||
2356 | int new_size; | |||
2357 | int current_bonus; | |||
2358 | ||||
2359 | current_bonus = bonus; | |||
2360 | ||||
2361 | while (using_hint[i].index > 0 && applets_hints[i].hints[using_hint[i].index - 1] < using_hint[i].size + current_bonus) { | |||
2362 | new_size = applets_hints[i].hints[using_hint[i].index - 1]; | |||
2363 | current_bonus = using_hint[i].size | |||
2364 | + current_bonus - new_size; | |||
2365 | total_size = total_size - using_hint[i].size | |||
2366 | + new_size; | |||
2367 | ||||
2368 | using_hint[i].index -= 2; | |||
2369 | using_hint[i].size = new_size; | |||
2370 | } | |||
2371 | ||||
2372 | new_size = MIN (applets_hints[i].hints[using_hint[i].index],(((applets_hints[i].hints[using_hint[i].index]) < (using_hint [i].size + current_bonus)) ? (applets_hints[i].hints[using_hint [i].index]) : (using_hint[i].size + current_bonus)) | |||
2373 | using_hint[i].size + current_bonus)(((applets_hints[i].hints[using_hint[i].index]) < (using_hint [i].size + current_bonus)) ? (applets_hints[i].hints[using_hint [i].index]) : (using_hint[i].size + current_bonus)); | |||
2374 | if (new_size > using_hint[i].size) { | |||
2375 | total_size += (new_size - using_hint[i].size); | |||
2376 | using_hint[i].size = new_size; | |||
2377 | } | |||
2378 | ||||
2379 | if (extra_bonus > 0) { | |||
2380 | new_size = MIN (applets_hints[i].hints[using_hint[i].index],(((applets_hints[i].hints[using_hint[i].index]) < (using_hint [i].size + extra_bonus)) ? (applets_hints[i].hints[using_hint [i].index]) : (using_hint[i].size + extra_bonus)) | |||
2381 | using_hint[i].size + extra_bonus)(((applets_hints[i].hints[using_hint[i].index]) < (using_hint [i].size + extra_bonus)) ? (applets_hints[i].hints[using_hint [i].index]) : (using_hint[i].size + extra_bonus)); | |||
2382 | if (new_size > using_hint[i].size) { | |||
2383 | total_size += (new_size | |||
2384 | - using_hint[i].size); | |||
2385 | extra_bonus -= (new_size | |||
2386 | - using_hint[i].size); | |||
2387 | using_hint[i].size = new_size; | |||
2388 | } | |||
2389 | } | |||
2390 | ||||
2391 | if (using_hint[i].size == applets_hints[i].hints[using_hint[i].index]) | |||
2392 | full_hints++; | |||
2393 | } | |||
2394 | } | |||
2395 | ||||
2396 | return total_size; | |||
2397 | } | |||
2398 | ||||
2399 | static void | |||
2400 | panel_toplevel_update_size (PanelToplevel *toplevel, | |||
2401 | CtkRequisition *requisition) | |||
2402 | { | |||
2403 | CtkWidget *widget; | |||
2404 | CtkStyleContext *context; | |||
2405 | CtkStateFlags state; | |||
2406 | CtkBorder padding; | |||
2407 | CdkRectangle monitor_geom; | |||
2408 | int width, height; | |||
2409 | int minimum_height; | |||
2410 | int non_panel_widget_size; | |||
2411 | ||||
2412 | if (toplevel->priv->animating) | |||
2413 | return; | |||
2414 | ||||
2415 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
2416 | context = ctk_widget_get_style_context (widget); | |||
2417 | state = ctk_widget_get_state_flags (widget); | |||
2418 | ctk_style_context_get_padding (context, state, &padding); | |||
2419 | ||||
2420 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
2421 | ||||
2422 | width = requisition->width; | |||
| ||||
2423 | height = requisition->height; | |||
2424 | ||||
2425 | if (!toplevel->priv->expand && | |||
2426 | !toplevel->priv->buttons_enabled && !toplevel->priv->attached) | |||
2427 | non_panel_widget_size = 2 * HANDLE_SIZE10; | |||
2428 | else | |||
2429 | non_panel_widget_size = 0; | |||
2430 | ||||
2431 | minimum_height = calculate_minimum_height (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), | |||
2432 | toplevel->priv->orientation); | |||
2433 | ||||
2434 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
2435 | ||||
2436 | height = MAX (MIN (MAX (height, toplevel->priv->size),(((((((((height) > (toplevel->priv->size)) ? (height ) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((height) > (toplevel->priv->size) ) ? (height) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((height) > ( toplevel->priv->size)) ? (height) : (toplevel->priv-> size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ( (((height) > (toplevel->priv->size)) ? (height) : (toplevel ->priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)) | |||
2437 | panel_toplevel_get_maximum_size (toplevel)),(((((((((height) > (toplevel->priv->size)) ? (height ) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((height) > (toplevel->priv->size) ) ? (height) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((height) > ( toplevel->priv->size)) ? (height) : (toplevel->priv-> size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ( (((height) > (toplevel->priv->size)) ? (height) : (toplevel ->priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)) | |||
2438 | minimum_height)(((((((((height) > (toplevel->priv->size)) ? (height ) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((height) > (toplevel->priv->size) ) ? (height) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((height) > ( toplevel->priv->size)) ? (height) : (toplevel->priv-> size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ( (((height) > (toplevel->priv->size)) ? (height) : (toplevel ->priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)); | |||
2439 | ||||
2440 | if (toplevel->priv->expand) | |||
2441 | width = monitor_geom.width; | |||
2442 | else { | |||
2443 | int max_width; | |||
2444 | ||||
2445 | if (!toplevel->priv->attached) | |||
2446 | max_width = monitor_geom.width; | |||
2447 | else { | |||
2448 | if (panel_toplevel_get_orientation (toplevel->priv->attach_toplevel) == PANEL_ORIENTATION_LEFT) | |||
2449 | max_width = monitor_geom.width | |||
2450 | - toplevel->priv->geometry.x; | |||
2451 | else | |||
2452 | max_width = toplevel->priv->geometry.x + | |||
2453 | toplevel->priv->geometry.width; | |||
2454 | } | |||
2455 | ||||
2456 | width = panel_toplevel_update_size_from_hints ( | |||
2457 | toplevel, | |||
2458 | requisition->width, | |||
2459 | max_width, | |||
2460 | non_panel_widget_size); | |||
2461 | } | |||
2462 | ||||
2463 | width = MAX (MINIMUM_WIDTH, width)(((100) > (width)) ? (100) : (width)); | |||
2464 | } else { | |||
2465 | width = MAX (MIN (MAX (width, toplevel->priv->size),(((((((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((width) > (toplevel ->priv->size)) ? (width) : (toplevel->priv->size) )) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width ) > (toplevel->priv->size)) ? (width) : (toplevel-> priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)) | |||
2466 | panel_toplevel_get_maximum_size (toplevel)),(((((((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((width) > (toplevel ->priv->size)) ? (width) : (toplevel->priv->size) )) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width ) > (toplevel->priv->size)) ? (width) : (toplevel-> priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)) | |||
2467 | minimum_height)(((((((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width) > (toplevel->priv->size)) ? (width) : (toplevel->priv->size))) : (panel_toplevel_get_maximum_size (toplevel)))) > (minimum_height)) ? (((((((width) > (toplevel ->priv->size)) ? (width) : (toplevel->priv->size) )) < (panel_toplevel_get_maximum_size (toplevel))) ? ((((width ) > (toplevel->priv->size)) ? (width) : (toplevel-> priv->size))) : (panel_toplevel_get_maximum_size (toplevel )))) : (minimum_height)); | |||
2468 | ||||
2469 | if (toplevel->priv->expand) | |||
2470 | height = monitor_geom.height; | |||
2471 | else { | |||
2472 | int max_height; | |||
2473 | ||||
2474 | if (!toplevel->priv->attached) | |||
2475 | max_height = monitor_geom.height; | |||
2476 | else { | |||
2477 | if (panel_toplevel_get_orientation (toplevel->priv->attach_toplevel) == PANEL_ORIENTATION_TOP) | |||
2478 | max_height = monitor_geom.height | |||
2479 | - toplevel->priv->geometry.y; | |||
2480 | else | |||
2481 | max_height = toplevel->priv->geometry.y + | |||
2482 | toplevel->priv->geometry.height; | |||
2483 | } | |||
2484 | ||||
2485 | height = panel_toplevel_update_size_from_hints ( | |||
2486 | toplevel, | |||
2487 | requisition->height, | |||
2488 | max_height, | |||
2489 | non_panel_widget_size); | |||
2490 | } | |||
2491 | ||||
2492 | height = MAX (MINIMUM_WIDTH, height)(((100) > (height)) ? (100) : (height)); | |||
2493 | } | |||
2494 | ||||
2495 | if (toplevel->priv->edges & PANEL_EDGE_TOP) | |||
2496 | height += padding.top; | |||
2497 | if (toplevel->priv->edges & PANEL_EDGE_BOTTOM) | |||
2498 | height += padding.bottom; | |||
2499 | if (toplevel->priv->edges & PANEL_EDGE_LEFT) | |||
2500 | width += padding.left; | |||
2501 | if (toplevel->priv->edges & PANEL_EDGE_RIGHT) | |||
2502 | width += padding.right; | |||
2503 | ||||
2504 | toplevel->priv->geometry.width = CLAMP (width, 0, monitor_geom.width)(((width) > (monitor_geom.width)) ? (monitor_geom.width) : (((width) < (0)) ? (0) : (width))); | |||
2505 | toplevel->priv->geometry.height = CLAMP (height, 0, monitor_geom.height)(((height) > (monitor_geom.height)) ? (monitor_geom.height ) : (((height) < (0)) ? (0) : (height))); | |||
2506 | toplevel->priv->original_width = toplevel->priv->geometry.width; | |||
2507 | toplevel->priv->original_height = toplevel->priv->geometry.height; | |||
2508 | } | |||
2509 | ||||
2510 | static void | |||
2511 | panel_toplevel_update_geometry (PanelToplevel *toplevel, | |||
2512 | CtkRequisition *requisition) | |||
2513 | { | |||
2514 | toplevel->priv->updated_geometry_initial = TRUE(!(0)); | |||
2515 | panel_toplevel_update_size (toplevel, requisition); | |||
2516 | panel_toplevel_update_position (toplevel); | |||
2517 | ||||
2518 | panel_toplevel_update_struts (toplevel, FALSE(0)); | |||
2519 | ||||
2520 | #ifdef HAVE_X111 | |||
2521 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { | |||
2522 | if (toplevel->priv->state == PANEL_STATE_NORMAL || | |||
2523 | toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) { | |||
2524 | panel_struts_update_toplevel_geometry (toplevel, | |||
2525 | &toplevel->priv->geometry.x, | |||
2526 | &toplevel->priv->geometry.y, | |||
2527 | &toplevel->priv->geometry.width, | |||
2528 | &toplevel->priv->geometry.height); | |||
2529 | } else { | |||
2530 | panel_struts_update_toplevel_geometry (toplevel, | |||
2531 | &toplevel->priv->geometry.x, | |||
2532 | &toplevel->priv->geometry.y, | |||
2533 | NULL((void*)0), NULL((void*)0)); | |||
2534 | } | |||
2535 | } | |||
2536 | #endif // HAVE_X11 | |||
2537 | ||||
2538 | panel_toplevel_update_edges (toplevel); | |||
2539 | panel_toplevel_update_description (toplevel); | |||
2540 | } | |||
2541 | ||||
2542 | static void | |||
2543 | panel_toplevel_attach_widget_destroyed (PanelToplevel *toplevel) | |||
2544 | { | |||
2545 | panel_toplevel_detach (toplevel); | |||
2546 | } | |||
2547 | ||||
2548 | static gboolean | |||
2549 | panel_toplevel_attach_widget_configure (PanelToplevel *toplevel) | |||
2550 | { | |||
2551 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2552 | ||||
2553 | return FALSE(0); | |||
2554 | } | |||
2555 | ||||
2556 | static void | |||
2557 | panel_toplevel_update_attach_orientation (PanelToplevel *toplevel) | |||
2558 | { | |||
2559 | PanelOrientation attach_orientation; | |||
2560 | PanelOrientation orientation; | |||
2561 | ||||
2562 | attach_orientation = | |||
2563 | panel_toplevel_get_orientation (toplevel->priv->attach_toplevel); | |||
2564 | ||||
2565 | orientation = toplevel->priv->orientation; | |||
2566 | ||||
2567 | switch (attach_orientation) { | |||
2568 | case PANEL_ORIENTATION_TOP: | |||
2569 | orientation = PANEL_ORIENTATION_LEFT; | |||
2570 | break; | |||
2571 | case PANEL_ORIENTATION_BOTTOM: | |||
2572 | orientation = PANEL_ORIENTATION_RIGHT; | |||
2573 | break; | |||
2574 | case PANEL_ORIENTATION_LEFT: | |||
2575 | orientation = PANEL_ORIENTATION_TOP; | |||
2576 | break; | |||
2577 | case PANEL_ORIENTATION_RIGHT: | |||
2578 | orientation = PANEL_ORIENTATION_BOTTOM; | |||
2579 | break; | |||
2580 | default: | |||
2581 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 2581, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
2582 | break; | |||
2583 | } | |||
2584 | ||||
2585 | panel_toplevel_set_orientation (toplevel, orientation); | |||
2586 | } | |||
2587 | ||||
2588 | static void | |||
2589 | panel_toplevel_attach_widget_parent_set (PanelToplevel *toplevel, | |||
2590 | CtkWidget *previous_parent, | |||
2591 | CtkWidget *attach_widget) | |||
2592 | { | |||
2593 | CtkWidget *panel_widget; | |||
2594 | ||||
2595 | panel_widget = ctk_widget_get_parent (CTK_WIDGET (attach_widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((attach_widget)), ((ctk_widget_get_type ()))))))); | |||
2596 | if (!panel_widget) | |||
2597 | return; | |||
2598 | ||||
2599 | g_assert (PANEL_IS_WIDGET (panel_widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((panel_widget)); GType __t = ((panel_widget_get_type())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0) ); else __r = g_type_check_instance_is_a (__inst, __t); __r; } ))))) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 2599, ((const char*) (__func__)), "PANEL_IS_WIDGET (panel_widget)" ); } while (0); | |||
2600 | ||||
2601 | toplevel->priv->attach_toplevel = PANEL_WIDGET (panel_widget)((((PanelWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((panel_widget)), ((panel_widget_get_type()))))))->toplevel; | |||
2602 | panel_toplevel_update_attach_orientation (toplevel); | |||
2603 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2604 | } | |||
2605 | ||||
2606 | static void | |||
2607 | panel_toplevel_attach_toplevel_hiding (PanelToplevel *toplevel) | |||
2608 | { | |||
2609 | if (!panel_toplevel_get_is_hidden (toplevel)) { | |||
2610 | panel_toplevel_hide (toplevel, FALSE(0), -1); | |||
2611 | ||||
2612 | toplevel->priv->attach_hidden = TRUE(!(0)); | |||
2613 | } | |||
2614 | } | |||
2615 | ||||
2616 | static void | |||
2617 | panel_toplevel_attach_toplevel_unhiding (PanelToplevel *toplevel) | |||
2618 | { | |||
2619 | if (!toplevel->priv->attach_hidden) | |||
2620 | return; | |||
2621 | ||||
2622 | toplevel->priv->attach_hidden = FALSE(0); | |||
2623 | ||||
2624 | panel_toplevel_unhide (toplevel); | |||
2625 | } | |||
2626 | ||||
2627 | static void | |||
2628 | panel_toplevel_reverse_arrow (PanelToplevel *toplevel, | |||
2629 | CtkWidget *button) | |||
2630 | { | |||
2631 | CtkArrowType arrow_type; | |||
2632 | ||||
2633 | arrow_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "arrow-type"))((gint) (glong) (g_object_get_data (((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), (((GType) ((20) << (2))) ))))), "arrow-type"))); | |||
2634 | ||||
2635 | switch (arrow_type) { | |||
2636 | case CTK_ARROW_UP: | |||
2637 | arrow_type = CTK_ARROW_DOWN; | |||
2638 | break; | |||
2639 | case CTK_ARROW_DOWN: | |||
2640 | arrow_type = CTK_ARROW_UP; | |||
2641 | break; | |||
2642 | case CTK_ARROW_LEFT: | |||
2643 | arrow_type = CTK_ARROW_RIGHT; | |||
2644 | break; | |||
2645 | case CTK_ARROW_RIGHT: | |||
2646 | arrow_type = CTK_ARROW_LEFT; | |||
2647 | break; | |||
2648 | default: | |||
2649 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 2649, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
2650 | break; | |||
2651 | } | |||
2652 | ||||
2653 | g_object_set_data (G_OBJECT (button)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), (((GType) ((20) << (2)))))))), "arrow-type", GINT_TO_POINTER (arrow_type)((gpointer) (glong) (arrow_type))); | |||
2654 | ||||
2655 | set_arrow_type (CTK_IMAGE (ctk_bin_get_child (CTK_BIN (button)))((((CtkImage*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_bin_get_child (((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), ((ctk_bin_get_type ()))))))))) , ((ctk_image_get_type ())))))), arrow_type); | |||
2656 | } | |||
2657 | ||||
2658 | static void | |||
2659 | panel_toplevel_reverse_arrows (PanelToplevel *toplevel) | |||
2660 | { | |||
2661 | panel_toplevel_reverse_arrow (toplevel, toplevel->priv->hide_button_top); | |||
2662 | panel_toplevel_reverse_arrow (toplevel, toplevel->priv->hide_button_bottom); | |||
2663 | panel_toplevel_reverse_arrow (toplevel, toplevel->priv->hide_button_left); | |||
2664 | panel_toplevel_reverse_arrow (toplevel, toplevel->priv->hide_button_right); | |||
2665 | } | |||
2666 | ||||
2667 | static void | |||
2668 | panel_toplevel_disconnect_attached (PanelToplevel *toplevel) | |||
2669 | { | |||
2670 | int i; | |||
2671 | ||||
2672 | for (i = 0; i < N_ATTACH_TOPLEVEL_SIGNALS5; i++) { | |||
2673 | if (!toplevel->priv->attach_toplevel_signals [i]) | |||
2674 | continue; | |||
2675 | ||||
2676 | g_signal_handler_disconnect ( | |||
2677 | toplevel->priv->attach_toplevel, | |||
2678 | toplevel->priv->attach_toplevel_signals [i]); | |||
2679 | toplevel->priv->attach_toplevel_signals [i] = 0; | |||
2680 | } | |||
2681 | ||||
2682 | for (i = 0; i < N_ATTACH_WIDGET_SIGNALS5; i++) { | |||
2683 | if (!toplevel->priv->attach_widget_signals [i]) | |||
2684 | continue; | |||
2685 | ||||
2686 | g_signal_handler_disconnect ( | |||
2687 | toplevel->priv->attach_widget, | |||
2688 | toplevel->priv->attach_widget_signals [i]); | |||
2689 | toplevel->priv->attach_widget_signals [i] = 0; | |||
2690 | } | |||
2691 | } | |||
2692 | ||||
2693 | static void | |||
2694 | panel_toplevel_connect_attached (PanelToplevel *toplevel) | |||
2695 | { | |||
2696 | gulong *signals; | |||
2697 | int i = 0; | |||
2698 | ||||
2699 | signals = toplevel->priv->attach_toplevel_signals; | |||
2700 | ||||
2701 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2702 | toplevel->priv->attach_toplevel, "destroy",g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2703 | G_CALLBACK (panel_toplevel_attach_widget_destroyed), toplevel)g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2704 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("notify::orientation"), (((GCallback) (panel_toplevel_update_attach_orientation ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2705 | toplevel->priv->attach_toplevel, "notify::orientation",g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("notify::orientation"), (((GCallback) (panel_toplevel_update_attach_orientation ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2706 | G_CALLBACK (panel_toplevel_update_attach_orientation), toplevel)g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("notify::orientation"), (((GCallback) (panel_toplevel_update_attach_orientation ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2707 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2708 | toplevel->priv->attach_toplevel, "configure-event",g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2709 | G_CALLBACK (panel_toplevel_attach_widget_configure), toplevel)g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2710 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("hiding"), (((GCallback) (panel_toplevel_attach_toplevel_hiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2711 | toplevel->priv->attach_toplevel, "hiding",g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("hiding"), (((GCallback) (panel_toplevel_attach_toplevel_hiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2712 | G_CALLBACK (panel_toplevel_attach_toplevel_hiding), toplevel)g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("hiding"), (((GCallback) (panel_toplevel_attach_toplevel_hiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2713 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("unhiding"), (((GCallback) (panel_toplevel_attach_toplevel_unhiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2714 | toplevel->priv->attach_toplevel, "unhiding",g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("unhiding"), (((GCallback) (panel_toplevel_attach_toplevel_unhiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2715 | G_CALLBACK (panel_toplevel_attach_toplevel_unhiding), toplevel)g_signal_connect_data ((toplevel->priv->attach_toplevel ), ("unhiding"), (((GCallback) (panel_toplevel_attach_toplevel_unhiding ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2716 | ||||
2717 | g_assert (i == N_ATTACH_TOPLEVEL_SIGNALS)do { if (i == 5) ; else g_assertion_message_expr (((gchar*) 0 ), "panel-toplevel.c", 2717, ((const char*) (__func__)), "i == N_ATTACH_TOPLEVEL_SIGNALS" ); } while (0); | |||
2718 | ||||
2719 | signals = toplevel->priv->attach_widget_signals; | |||
2720 | i = 0; | |||
2721 | ||||
2722 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_widget), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2723 | toplevel->priv->attach_widget, "destroy",g_signal_connect_data ((toplevel->priv->attach_widget), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2724 | G_CALLBACK (panel_toplevel_attach_widget_destroyed), toplevel)g_signal_connect_data ((toplevel->priv->attach_widget), ("destroy"), (((GCallback) (panel_toplevel_attach_widget_destroyed ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2725 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_widget), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2726 | toplevel->priv->attach_widget, "configure-event",g_signal_connect_data ((toplevel->priv->attach_widget), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2727 | G_CALLBACK (panel_toplevel_attach_widget_configure), toplevel)g_signal_connect_data ((toplevel->priv->attach_widget), ("configure-event"), (((GCallback) (panel_toplevel_attach_widget_configure ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2728 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_widget), ("parent-set"), (((GCallback) (panel_toplevel_attach_widget_parent_set ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2729 | toplevel->priv->attach_widget, "parent-set",g_signal_connect_data ((toplevel->priv->attach_widget), ("parent-set"), (((GCallback) (panel_toplevel_attach_widget_parent_set ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
2730 | G_CALLBACK (panel_toplevel_attach_widget_parent_set), toplevel)g_signal_connect_data ((toplevel->priv->attach_widget), ("parent-set"), (((GCallback) (panel_toplevel_attach_widget_parent_set ))), (toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
2731 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_widget), ("show"), (((GCallback) (ctk_widget_show))), (toplevel), ((void *)0), G_CONNECT_SWAPPED) | |||
2732 | toplevel->priv->attach_widget, "show",g_signal_connect_data ((toplevel->priv->attach_widget), ("show"), (((GCallback) (ctk_widget_show))), (toplevel), ((void *)0), G_CONNECT_SWAPPED) | |||
2733 | G_CALLBACK (ctk_widget_show), toplevel)g_signal_connect_data ((toplevel->priv->attach_widget), ("show"), (((GCallback) (ctk_widget_show))), (toplevel), ((void *)0), G_CONNECT_SWAPPED); | |||
2734 | signals [i++] = g_signal_connect_swapped (g_signal_connect_data ((toplevel->priv->attach_widget), ("hide"), (((GCallback) (ctk_widget_hide))), (toplevel), ((void *)0), G_CONNECT_SWAPPED) | |||
2735 | toplevel->priv->attach_widget, "hide",g_signal_connect_data ((toplevel->priv->attach_widget), ("hide"), (((GCallback) (ctk_widget_hide))), (toplevel), ((void *)0), G_CONNECT_SWAPPED) | |||
2736 | G_CALLBACK (ctk_widget_hide), toplevel)g_signal_connect_data ((toplevel->priv->attach_widget), ("hide"), (((GCallback) (ctk_widget_hide))), (toplevel), ((void *)0), G_CONNECT_SWAPPED); | |||
2737 | ||||
2738 | g_assert (i == N_ATTACH_WIDGET_SIGNALS)do { if (i == 5) ; else g_assertion_message_expr (((gchar*) 0 ), "panel-toplevel.c", 2738, ((const char*) (__func__)), "i == N_ATTACH_WIDGET_SIGNALS" ); } while (0); | |||
2739 | } | |||
2740 | ||||
2741 | void | |||
2742 | panel_toplevel_attach_to_widget (PanelToplevel *toplevel, | |||
2743 | PanelToplevel *attach_toplevel, | |||
2744 | CtkWidget *attach_widget) | |||
2745 | { | |||
2746 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
2747 | g_return_if_fail (PANEL_IS_TOPLEVEL (attach_toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((attach_toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0 ), ((const char*) (__func__)), "PANEL_IS_TOPLEVEL (attach_toplevel)" ); return; } } while (0); | |||
2748 | g_return_if_fail (CTK_IS_WIDGET (attach_widget))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((attach_widget)); GType __t = ((ctk_widget_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0) ); else __r = g_type_check_instance_is_a (__inst, __t); __r; } )))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "CTK_IS_WIDGET (attach_widget)"); return ; } } while (0); | |||
2749 | ||||
2750 | if (toplevel->priv->attached) | |||
2751 | panel_toplevel_disconnect_attached (toplevel); | |||
2752 | ||||
2753 | toplevel->priv->attached = TRUE(!(0)); | |||
2754 | ||||
2755 | /* Cancelling the initial animation for drawers in | |||
2756 | * panel_toplevel_initially_hide() is not enough, since this will | |||
2757 | * happen only when the toplevel is realized, which might be too late | |||
2758 | * for drawers (since it's realized when the drawer is clicked) */ | |||
2759 | toplevel->priv->initial_animation_done = TRUE(!(0)); | |||
2760 | ||||
2761 | toplevel->priv->attach_toplevel = attach_toplevel; | |||
2762 | toplevel->priv->attach_widget = attach_widget; | |||
2763 | ||||
2764 | panel_toplevel_connect_attached (toplevel); | |||
2765 | ||||
2766 | panel_toplevel_reverse_arrows (toplevel); | |||
2767 | panel_toplevel_set_expand (toplevel, FALSE(0)); | |||
2768 | panel_toplevel_update_attach_orientation (toplevel); | |||
2769 | panel_toplevel_update_hide_buttons (toplevel); | |||
2770 | ||||
2771 | ctk_window_set_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))), | |||
2772 | ctk_widget_get_screen (CTK_WIDGET (attach_toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((attach_toplevel)), ((ctk_widget_get_type ())))))))); | |||
2773 | panel_toplevel_set_monitor (toplevel, | |||
2774 | panel_toplevel_get_monitor (attach_toplevel)); | |||
2775 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
2776 | panel_toplevel_push_autohide_disabler (toplevel->priv->attach_toplevel); | |||
2777 | ||||
2778 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2779 | } | |||
2780 | ||||
2781 | void | |||
2782 | panel_toplevel_detach (PanelToplevel *toplevel) | |||
2783 | { | |||
2784 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
2785 | ||||
2786 | if (!toplevel->priv->attached) | |||
2787 | return; | |||
2788 | ||||
2789 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
2790 | panel_toplevel_pop_autohide_disabler (toplevel->priv->attach_toplevel); | |||
2791 | ||||
2792 | panel_toplevel_disconnect_attached (toplevel); | |||
2793 | ||||
2794 | panel_toplevel_reverse_arrows (toplevel); | |||
2795 | ||||
2796 | toplevel->priv->attached = FALSE(0); | |||
2797 | ||||
2798 | toplevel->priv->attach_toplevel = NULL((void*)0); | |||
2799 | toplevel->priv->attach_widget = NULL((void*)0); | |||
2800 | ||||
2801 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2802 | } | |||
2803 | ||||
2804 | gboolean | |||
2805 | panel_toplevel_get_is_attached (PanelToplevel *toplevel) | |||
2806 | { | |||
2807 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
2808 | ||||
2809 | return toplevel->priv->attached; | |||
2810 | } | |||
2811 | ||||
2812 | PanelToplevel * | |||
2813 | panel_toplevel_get_attach_toplevel (PanelToplevel *toplevel) | |||
2814 | { | |||
2815 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (((void *)0)); } } while (0); | |||
2816 | ||||
2817 | return toplevel->priv->attach_toplevel; | |||
2818 | } | |||
2819 | ||||
2820 | CtkWidget * | |||
2821 | panel_toplevel_get_attach_widget (PanelToplevel *toplevel) | |||
2822 | { | |||
2823 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (((void *)0)); } } while (0); | |||
2824 | ||||
2825 | return toplevel->priv->attach_widget; | |||
2826 | } | |||
2827 | ||||
2828 | static gboolean | |||
2829 | panel_toplevel_popup_panel_menu (PanelToplevel *toplevel) | |||
2830 | { | |||
2831 | gboolean retval = FALSE(0); | |||
2832 | ||||
2833 | g_signal_emit_by_name (toplevel, "popup_menu", &retval); | |||
2834 | ||||
2835 | return retval; | |||
2836 | } | |||
2837 | ||||
2838 | static gboolean | |||
2839 | panel_toplevel_toggle_expand (PanelToplevel *toplevel) | |||
2840 | { | |||
2841 | panel_toplevel_set_expand (toplevel, !toplevel->priv->expand); | |||
2842 | ||||
2843 | return TRUE(!(0)); | |||
2844 | } | |||
2845 | ||||
2846 | static gboolean | |||
2847 | panel_toplevel_expand (PanelToplevel *toplevel) | |||
2848 | { | |||
2849 | panel_toplevel_set_expand (toplevel, TRUE(!(0))); | |||
2850 | ||||
2851 | return TRUE(!(0)); | |||
2852 | } | |||
2853 | ||||
2854 | static gboolean | |||
2855 | panel_toplevel_unexpand (PanelToplevel *toplevel) | |||
2856 | { | |||
2857 | panel_toplevel_set_expand (toplevel, FALSE(0)); | |||
2858 | ||||
2859 | return TRUE(!(0)); | |||
2860 | } | |||
2861 | ||||
2862 | static gboolean | |||
2863 | panel_toplevel_toggle_hidden (PanelToplevel *toplevel) | |||
2864 | { | |||
2865 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
2866 | panel_toplevel_hide (toplevel, toplevel->priv->auto_hide, -1); | |||
2867 | else | |||
2868 | panel_toplevel_unhide (toplevel); | |||
2869 | ||||
2870 | return FALSE(0); | |||
2871 | } | |||
2872 | ||||
2873 | static gboolean | |||
2874 | panel_toplevel_begin_move (PanelToplevel *toplevel) | |||
2875 | { | |||
2876 | if (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) | |||
2877 | return FALSE(0); | |||
2878 | ||||
2879 | panel_toplevel_begin_grab_op ( | |||
2880 | toplevel, PANEL_GRAB_OP_MOVE, TRUE(!(0)), CDK_CURRENT_TIME0L); | |||
2881 | ||||
2882 | return TRUE(!(0)); | |||
2883 | } | |||
2884 | ||||
2885 | static gboolean | |||
2886 | panel_toplevel_begin_resize (PanelToplevel *toplevel) | |||
2887 | { | |||
2888 | if (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) | |||
2889 | return FALSE(0); | |||
2890 | ||||
2891 | panel_toplevel_begin_grab_op ( | |||
2892 | toplevel, PANEL_GRAB_OP_RESIZE, TRUE(!(0)), CDK_CURRENT_TIME0L); | |||
2893 | ||||
2894 | return TRUE(!(0)); | |||
2895 | } | |||
2896 | ||||
2897 | static void | |||
2898 | panel_toplevel_move_resize_window (PanelToplevel *toplevel, | |||
2899 | gboolean move, | |||
2900 | gboolean resize) | |||
2901 | { | |||
2902 | CtkWidget *widget; | |||
2903 | ||||
2904 | GList *list; | |||
2905 | const char *id; | |||
2906 | int position; | |||
2907 | gboolean stick; | |||
2908 | ||||
2909 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
2910 | ||||
2911 | g_assert (ctk_widget_get_realized (widget))do { if (ctk_widget_get_realized (widget)) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 2911, ((const char*) (__func__ )), "ctk_widget_get_realized (widget)"); } while (0); | |||
2912 | ||||
2913 | if (move && resize) | |||
2914 | cdk_window_move_resize (ctk_widget_get_window (widget), | |||
2915 | toplevel->priv->geometry.x, | |||
2916 | toplevel->priv->geometry.y, | |||
2917 | toplevel->priv->geometry.width, | |||
2918 | toplevel->priv->geometry.height); | |||
2919 | else if (move) | |||
2920 | cdk_window_move (ctk_widget_get_window (widget), | |||
2921 | toplevel->priv->geometry.x, | |||
2922 | toplevel->priv->geometry.y); | |||
2923 | else if (resize) | |||
2924 | cdk_window_resize (ctk_widget_get_window (widget), | |||
2925 | toplevel->priv->geometry.width, | |||
2926 | toplevel->priv->geometry.height); | |||
2927 | ||||
2928 | if (resize || move) { | |||
2929 | for (list = toplevel->priv->panel_widget->applet_list; list != NULL((void*)0); list = g_list_next (list)((list) ? (((GList *)(list))->next) : ((void*)0))) { | |||
2930 | AppletData *ad = list->data; | |||
2931 | id = cafe_panel_applet_get_id_by_widget (ad->applet); | |||
2932 | ||||
2933 | if (!id) | |||
2934 | return; | |||
2935 | ||||
2936 | AppletInfo *info; | |||
2937 | info = cafe_panel_applet_get_by_id (id); | |||
2938 | ||||
2939 | stick = g_settings_get_boolean (info->settings, PANEL_OBJECT_PANEL_RIGHT_STICK_KEY"panel-right-stick"); | |||
2940 | ||||
2941 | if (stick) { | |||
2942 | position = g_settings_get_int (info->settings, PANEL_OBJECT_POSITION_KEY"position"); | |||
2943 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
2944 | ad->pos = toplevel->priv->geometry.width - position; | |||
2945 | } else { | |||
2946 | ad->pos = toplevel->priv->geometry.height - position; | |||
2947 | } | |||
2948 | } | |||
2949 | } | |||
2950 | } | |||
2951 | } | |||
2952 | ||||
2953 | static void | |||
2954 | panel_toplevel_initially_hide (PanelToplevel *toplevel) | |||
2955 | { | |||
2956 | if (!toplevel->priv->attached) { | |||
2957 | toplevel->priv->initial_animation_done = FALSE(0); | |||
2958 | ||||
2959 | /* We start the panel off hidden until all the applets are | |||
2960 | * loaded, and then finally slide it down when it's ready to be | |||
2961 | * used */ | |||
2962 | toplevel->priv->state = PANEL_STATE_AUTO_HIDDEN; | |||
2963 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
2964 | } else | |||
2965 | toplevel->priv->initial_animation_done = TRUE(!(0)); | |||
2966 | } | |||
2967 | ||||
2968 | static void | |||
2969 | set_background_default_style (CtkWidget *widget) | |||
2970 | { | |||
2971 | PanelToplevel *toplevel; | |||
2972 | CtkStyleContext *context; | |||
2973 | CtkStateFlags state; | |||
2974 | CdkRGBA *bg_color; | |||
2975 | cairo_pattern_t *bg_image; | |||
2976 | ||||
2977 | if (!ctk_widget_get_realized (widget)) | |||
2978 | return; | |||
2979 | ||||
2980 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
2981 | ||||
2982 | context = ctk_widget_get_style_context (widget); | |||
2983 | state = ctk_style_context_get_state (context); | |||
2984 | ||||
2985 | ctk_style_context_get (context, state, | |||
2986 | "background-color", &bg_color, | |||
2987 | "background-image", &bg_image, | |||
2988 | NULL((void*)0)); | |||
2989 | ||||
2990 | panel_background_set_default_style (&toplevel->background, | |||
2991 | bg_color, bg_image); | |||
2992 | ||||
2993 | if (bg_color) | |||
2994 | cdk_rgba_free (bg_color); | |||
2995 | ||||
2996 | if (bg_image) | |||
2997 | cairo_pattern_destroy (bg_image); | |||
2998 | } | |||
2999 | ||||
3000 | static void | |||
3001 | panel_toplevel_realize (CtkWidget *widget) | |||
3002 | { | |||
3003 | PanelToplevel *toplevel; | |||
3004 | CdkScreen *screen; | |||
3005 | CdkVisual *visual; | |||
3006 | CdkWindow *window; | |||
3007 | ||||
3008 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3009 | ||||
3010 | screen = ctk_widget_get_screen (widget); | |||
3011 | visual = cdk_screen_get_rgba_visual (screen); | |||
3012 | ||||
3013 | if (visual == NULL((void*)0)) | |||
3014 | visual = cdk_screen_get_system_visual (screen); | |||
3015 | ||||
3016 | ctk_widget_set_visual (widget, visual); | |||
3017 | ctk_window_stick (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_window_get_type ()))))))); | |||
3018 | ctk_window_set_decorated (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_window_get_type ())))))), FALSE(0)); | |||
3019 | ctk_window_stick (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_window_get_type ()))))))); | |||
3020 | ctk_window_set_type_hint (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_window_get_type ())))))), CDK_WINDOW_TYPE_HINT_DOCK); | |||
3021 | ||||
3022 | CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->realize (widget); | |||
3023 | ||||
3024 | window = ctk_widget_get_window (widget); | |||
3025 | set_background_default_style (widget); | |||
3026 | panel_background_realized (&toplevel->background, window); | |||
3027 | ||||
3028 | #ifdef HAVE_X111 | |||
3029 | if (CDK_IS_X11_WINDOW (window)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (window)); GType __t = ((cdk_x11_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { | |||
3030 | panel_struts_set_window_hint (toplevel); | |||
3031 | cdk_window_set_geometry_hints (window, NULL((void*)0), 0); | |||
3032 | } | |||
3033 | #endif // HAVE_X11 | |||
3034 | ||||
3035 | cdk_window_set_group (window, window); | |||
3036 | panel_toplevel_initially_hide (toplevel); | |||
3037 | ||||
3038 | panel_toplevel_move_resize_window (toplevel, TRUE(!(0)), TRUE(!(0))); | |||
3039 | } | |||
3040 | ||||
3041 | static void | |||
3042 | panel_toplevel_disconnect_timeouts (PanelToplevel *toplevel) | |||
3043 | { | |||
3044 | if (toplevel->priv->hide_timeout) | |||
3045 | g_source_remove (toplevel->priv->hide_timeout); | |||
3046 | toplevel->priv->hide_timeout = 0; | |||
3047 | ||||
3048 | if (toplevel->priv->unhide_timeout) | |||
3049 | g_source_remove (toplevel->priv->unhide_timeout); | |||
3050 | toplevel->priv->unhide_timeout = 0; | |||
3051 | ||||
3052 | if (toplevel->priv->animation_timeout) | |||
3053 | g_source_remove (toplevel->priv->animation_timeout); | |||
3054 | toplevel->priv->animation_timeout = 0; | |||
3055 | } | |||
3056 | ||||
3057 | static void | |||
3058 | panel_toplevel_unrealize (CtkWidget *widget) | |||
3059 | { | |||
3060 | PanelToplevel *toplevel; | |||
3061 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3062 | panel_toplevel_disconnect_timeouts (toplevel); | |||
3063 | panel_background_unrealized (&toplevel->background); | |||
3064 | CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->unrealize (widget); | |||
3065 | } | |||
3066 | ||||
3067 | static void | |||
3068 | panel_toplevel_dispose (GObject *widget) | |||
3069 | { | |||
3070 | PanelToplevel *toplevel = (PanelToplevel *) widget; | |||
3071 | ||||
3072 | if (toplevel->priv->settings_path) { | |||
3073 | g_free (toplevel->priv->settings_path); | |||
3074 | toplevel->priv->settings_path = NULL((void*)0); | |||
3075 | } | |||
3076 | ||||
3077 | if (toplevel->settings) { | |||
3078 | g_signal_handlers_disconnect_by_data (toplevel->settings, toplevel)g_signal_handlers_disconnect_matched ((toplevel->settings) , G_SIGNAL_MATCH_DATA, 0, 0, ((void*)0), ((void*)0), (toplevel )); | |||
3079 | g_object_unref (toplevel->settings); | |||
3080 | toplevel->settings = NULL((void*)0); | |||
3081 | } | |||
3082 | ||||
3083 | if (toplevel->queued_settings) { | |||
3084 | g_object_unref (toplevel->queued_settings); | |||
3085 | toplevel->queued_settings = NULL((void*)0); | |||
3086 | } | |||
3087 | ||||
3088 | if (toplevel->background_settings) { | |||
3089 | g_signal_handlers_disconnect_by_data (toplevel->background_settings, toplevel)g_signal_handlers_disconnect_matched ((toplevel->background_settings ), G_SIGNAL_MATCH_DATA, 0, 0, ((void*)0), ((void*)0), (toplevel )); | |||
3090 | g_object_unref (toplevel->background_settings); | |||
3091 | toplevel->background_settings = NULL((void*)0); | |||
3092 | } | |||
3093 | ||||
3094 | if (toplevel->priv->ctk_settings) { | |||
3095 | g_signal_handlers_disconnect_by_func (toplevel->priv->ctk_settings,g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)) | |||
3096 | G_CALLBACK (panel_toplevel_drag_threshold_changed),g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)) | |||
3097 | toplevel)g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)); | |||
3098 | toplevel->priv->ctk_settings = NULL((void*)0); | |||
3099 | ||||
3100 | panel_background_free (&toplevel->background); | |||
3101 | } | |||
3102 | ||||
3103 | if (toplevel->priv->attached) { | |||
3104 | panel_toplevel_disconnect_attached (toplevel); | |||
3105 | toplevel->priv->attached = FALSE(0); | |||
3106 | ||||
3107 | toplevel->priv->attach_toplevel = NULL((void*)0); | |||
3108 | toplevel->priv->attach_widget = NULL((void*)0); | |||
3109 | } | |||
3110 | ||||
3111 | if (toplevel->priv->description) { | |||
3112 | g_free (toplevel->priv->description); | |||
3113 | toplevel->priv->description = NULL((void*)0); | |||
3114 | } | |||
3115 | ||||
3116 | if (toplevel->priv->name) { | |||
3117 | g_free (toplevel->priv->name); | |||
3118 | toplevel->priv->name = NULL((void*)0); | |||
3119 | } | |||
3120 | ||||
3121 | panel_toplevel_disconnect_timeouts (toplevel); | |||
3122 | ||||
3123 | G_OBJECT_CLASS (panel_toplevel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), (((GType) ((20) << ( 2))))))))->dispose (widget); | |||
3124 | } | |||
3125 | ||||
3126 | static void | |||
3127 | panel_toplevel_check_resize (CtkContainer *container) | |||
3128 | { | |||
3129 | CtkAllocation allocation; | |||
3130 | CtkRequisition requisition; | |||
3131 | CtkWidget *widget; | |||
3132 | ||||
3133 | widget = CTK_WIDGET (container)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((container)), ((ctk_widget_get_type ())))))); | |||
3134 | ||||
3135 | if (!ctk_widget_get_visible (widget)) | |||
3136 | return; | |||
3137 | ||||
3138 | requisition.width = -1; | |||
3139 | requisition.height = -1; | |||
3140 | ||||
3141 | ctk_widget_get_preferred_size (widget, &requisition, NULL((void*)0)); | |||
3142 | ctk_widget_get_allocation (widget, &allocation); | |||
3143 | ||||
3144 | allocation.width = requisition.width; | |||
3145 | allocation.height = requisition.height; | |||
3146 | ||||
3147 | ctk_widget_size_allocate (widget, &allocation); | |||
3148 | } | |||
3149 | ||||
3150 | static void | |||
3151 | panel_toplevel_size_request (CtkWidget *widget, | |||
3152 | CtkRequisition *requisition) | |||
3153 | { | |||
3154 | PanelToplevel *toplevel; | |||
3155 | CtkBin *bin; | |||
3156 | CtkWidget *child; | |||
3157 | CdkRectangle old_geometry; | |||
3158 | int position_changed = FALSE(0); | |||
3159 | int size_changed = FALSE(0); | |||
3160 | ||||
3161 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3162 | bin = CTK_BIN (widget)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_bin_get_type ())))))); | |||
3163 | ||||
3164 | /* we get a size request when there are new monitors, so first try to | |||
3165 | * see if we need to move to a new monitor */ | |||
3166 | panel_toplevel_update_monitor (toplevel); | |||
3167 | ||||
3168 | child = ctk_bin_get_child (bin); | |||
3169 | if (child && ctk_widget_get_visible (child)) | |||
3170 | ctk_widget_get_preferred_size (child, requisition, NULL((void*)0)); | |||
3171 | ||||
3172 | old_geometry = toplevel->priv->geometry; | |||
3173 | ||||
3174 | panel_toplevel_update_geometry (toplevel, requisition); | |||
3175 | ||||
3176 | requisition->width = toplevel->priv->geometry.width; | |||
3177 | requisition->height = toplevel->priv->geometry.height; | |||
3178 | ||||
3179 | if (!ctk_widget_get_realized (widget)) | |||
3180 | return; | |||
3181 | ||||
3182 | if (old_geometry.width != toplevel->priv->geometry.width || | |||
3183 | old_geometry.height != toplevel->priv->geometry.height) | |||
3184 | size_changed = TRUE(!(0)); | |||
3185 | ||||
3186 | if (old_geometry.x != toplevel->priv->geometry.x || | |||
3187 | old_geometry.y != toplevel->priv->geometry.y) | |||
3188 | position_changed = TRUE(!(0)); | |||
3189 | ||||
3190 | panel_toplevel_move_resize_window (toplevel, position_changed, size_changed); | |||
3191 | } | |||
3192 | ||||
3193 | static void | |||
3194 | panel_toplevel_get_preferred_width (CtkWidget *widget, | |||
3195 | gint *minimum_width, | |||
3196 | gint *natural_width) | |||
3197 | { | |||
3198 | CtkRequisition req; | |||
3199 | panel_toplevel_size_request (widget, &req); | |||
3200 | *minimum_width = *natural_width = req.width; | |||
3201 | } | |||
3202 | ||||
3203 | static void | |||
3204 | panel_toplevel_get_preferred_height (CtkWidget *widget, | |||
3205 | gint *minimum_height, | |||
3206 | gint *natural_height) | |||
3207 | { | |||
3208 | CtkRequisition req; | |||
3209 | panel_toplevel_size_request (widget, &req); | |||
| ||||
3210 | *minimum_height = *natural_height = req.height; | |||
3211 | } | |||
3212 | ||||
3213 | static void | |||
3214 | set_background_region (PanelToplevel *toplevel) | |||
3215 | { | |||
3216 | CtkWidget *widget; | |||
3217 | CdkWindow *window; | |||
3218 | gint origin_x; | |||
3219 | gint origin_y; | |||
3220 | CtkAllocation allocation; | |||
3221 | CtkOrientation orientation; | |||
3222 | ||||
3223 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
3224 | ||||
3225 | if (!ctk_widget_get_realized (widget)) | |||
3226 | return; | |||
3227 | ||||
3228 | window = ctk_widget_get_window (widget); | |||
3229 | origin_x = -1; | |||
3230 | origin_y = -1; | |||
3231 | ||||
3232 | cdk_window_get_origin (window, &origin_x, &origin_y); | |||
3233 | ctk_widget_get_allocation (widget, &allocation); | |||
3234 | ||||
3235 | orientation = CTK_ORIENTATION_HORIZONTAL; | |||
3236 | if (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
3237 | orientation = CTK_ORIENTATION_VERTICAL; | |||
3238 | ||||
3239 | panel_background_change_region (&toplevel->background, orientation, | |||
3240 | origin_x, origin_y, | |||
3241 | allocation.width, allocation.height); | |||
3242 | } | |||
3243 | ||||
3244 | static void | |||
3245 | panel_toplevel_size_allocate (CtkWidget *widget, | |||
3246 | CtkAllocation *allocation) | |||
3247 | { | |||
3248 | PanelToplevel *toplevel = (PanelToplevel *) widget; | |||
3249 | CtkBin *bin = (CtkBin *) widget; | |||
3250 | CtkStyleContext *context; | |||
3251 | CtkStateFlags state; | |||
3252 | CtkBorder padding; | |||
3253 | CtkWidget *child; | |||
3254 | CtkAllocation challoc; | |||
3255 | CtkAllocation child_allocation; | |||
3256 | ||||
3257 | ctk_widget_set_allocation (widget, allocation); | |||
3258 | ||||
3259 | if (toplevel->priv->expand || | |||
3260 | toplevel->priv->buttons_enabled || | |||
3261 | toplevel->priv->attached) | |||
3262 | challoc = *allocation; | |||
3263 | else { | |||
3264 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
3265 | challoc.x = HANDLE_SIZE10; | |||
3266 | challoc.y = 0; | |||
3267 | challoc.width = allocation->width - 2 * HANDLE_SIZE10; | |||
3268 | challoc.height = allocation->height; | |||
3269 | } else { | |||
3270 | challoc.x = 0; | |||
3271 | challoc.y = HANDLE_SIZE10; | |||
3272 | challoc.width = allocation->width; | |||
3273 | challoc.height = allocation->height - 2 * HANDLE_SIZE10; | |||
3274 | } | |||
3275 | } | |||
3276 | ||||
3277 | state = ctk_widget_get_state_flags (widget); | |||
3278 | context = ctk_widget_get_style_context (widget); | |||
3279 | ctk_style_context_get_padding (context, state, &padding); | |||
3280 | ||||
3281 | if (toplevel->priv->edges & PANEL_EDGE_TOP) { | |||
3282 | challoc.y += padding.top; | |||
3283 | challoc.height -= padding.top; | |||
3284 | } | |||
3285 | ||||
3286 | if (toplevel->priv->edges & PANEL_EDGE_LEFT) { | |||
3287 | challoc.x += padding.left; | |||
3288 | challoc.width -= padding.left; | |||
3289 | } | |||
3290 | ||||
3291 | if (toplevel->priv->edges & PANEL_EDGE_BOTTOM) | |||
3292 | challoc.height -= padding.bottom; | |||
3293 | ||||
3294 | if (toplevel->priv->edges & PANEL_EDGE_RIGHT) | |||
3295 | challoc.width -= padding.right; | |||
3296 | ||||
3297 | challoc.width = MAX (1, challoc.width)(((1) > (challoc.width)) ? (1) : (challoc.width)); | |||
3298 | challoc.height = MAX (1, challoc.height)(((1) > (challoc.height)) ? (1) : (challoc.height)); | |||
3299 | ||||
3300 | child = ctk_bin_get_child (bin); | |||
3301 | ctk_widget_get_allocation (child, &child_allocation); | |||
3302 | ||||
3303 | if (ctk_widget_get_mapped (widget) && | |||
3304 | (challoc.x != child_allocation.x || | |||
3305 | challoc.y != child_allocation.y || | |||
3306 | challoc.width != child_allocation.width || | |||
3307 | challoc.height != child_allocation.height)) { | |||
3308 | CtkAllocation allocation; | |||
3309 | ||||
3310 | ctk_widget_get_allocation (widget, &allocation); | |||
3311 | cdk_window_invalidate_rect (ctk_widget_get_window (widget), &allocation, FALSE(0)); | |||
3312 | } | |||
3313 | ||||
3314 | if (child && ctk_widget_get_visible (child)) | |||
3315 | ctk_widget_size_allocate (child, &challoc); | |||
3316 | ||||
3317 | set_background_region (toplevel); | |||
3318 | } | |||
3319 | ||||
3320 | static gboolean panel_toplevel_draw(CtkWidget* widget, cairo_t* cr) | |||
3321 | { | |||
3322 | PanelToplevel* toplevel = (PanelToplevel*) widget; | |||
3323 | PanelFrameEdge edges; | |||
3324 | gboolean retval = FALSE(0); | |||
3325 | int awidth; | |||
3326 | int aheight; | |||
3327 | CtkStyleContext *context; | |||
3328 | CtkStateFlags state; | |||
3329 | CtkBorder padding; | |||
3330 | ||||
3331 | if (!ctk_widget_is_drawable (widget)) | |||
3332 | return retval; | |||
3333 | ||||
3334 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->draw) | |||
3335 | retval = CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->draw (widget, cr); | |||
3336 | ||||
3337 | edges = toplevel->priv->edges; | |||
3338 | panel_frame_draw (widget, cr, edges); | |||
3339 | ||||
3340 | if (toplevel->priv->expand || | |||
3341 | toplevel->priv->buttons_enabled || | |||
3342 | toplevel->priv->attached) | |||
3343 | return retval; | |||
3344 | ||||
3345 | state = ctk_widget_get_state_flags (widget); | |||
3346 | awidth = ctk_widget_get_allocated_width (widget); | |||
3347 | aheight = ctk_widget_get_allocated_height (widget); | |||
3348 | ||||
3349 | context = ctk_widget_get_style_context (widget); | |||
3350 | ctk_style_context_get_padding (context, state, &padding); | |||
3351 | ||||
3352 | ctk_style_context_save (context); | |||
3353 | ctk_style_context_set_state (context, state); | |||
3354 | ||||
3355 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) { | |||
3356 | int x, y, width, height; | |||
3357 | ||||
3358 | x = 0; | |||
3359 | y = 0; | |||
3360 | height = aheight; | |||
3361 | width = HANDLE_SIZE10; | |||
3362 | ||||
3363 | if (edges & PANEL_EDGE_TOP) { | |||
3364 | y += padding.top; | |||
3365 | height -= padding.top; | |||
3366 | } | |||
3367 | if (edges & PANEL_EDGE_BOTTOM) | |||
3368 | height -= padding.bottom; | |||
3369 | if (edges & PANEL_EDGE_LEFT) | |||
3370 | x += padding.left; | |||
3371 | ||||
3372 | cairo_save (cr); | |||
3373 | ctk_render_handle (context, cr, x, y, width, height); | |||
3374 | cairo_restore (cr); | |||
3375 | ||||
3376 | x = awidth - HANDLE_SIZE10; | |||
3377 | if (edges & PANEL_EDGE_RIGHT) | |||
3378 | x -= padding.right; | |||
3379 | ||||
3380 | cairo_save (cr); | |||
3381 | ctk_render_handle (context, cr, x, y, width, height); | |||
3382 | cairo_restore (cr); | |||
3383 | } else { | |||
3384 | int x, y, width, height; | |||
3385 | ||||
3386 | x = 0; | |||
3387 | y = 0; | |||
3388 | width = awidth; | |||
3389 | height = HANDLE_SIZE10; | |||
3390 | ||||
3391 | if (edges & PANEL_EDGE_LEFT) { | |||
3392 | x += padding.left; | |||
3393 | width -= padding.left; | |||
3394 | } | |||
3395 | if (edges & PANEL_EDGE_RIGHT) | |||
3396 | width -= padding.right; | |||
3397 | if (edges & PANEL_EDGE_TOP) | |||
3398 | y += padding.top; | |||
3399 | ||||
3400 | cairo_save (cr); | |||
3401 | ctk_render_handle (context, cr, x, y, width, height); | |||
3402 | cairo_restore (cr); | |||
3403 | ||||
3404 | y = aheight - HANDLE_SIZE10; | |||
3405 | if (edges & PANEL_EDGE_BOTTOM) | |||
3406 | y -= padding.bottom; | |||
3407 | ||||
3408 | cairo_save (cr); | |||
3409 | ctk_render_handle (context, cr, x, y, width, height); | |||
3410 | cairo_restore (cr); | |||
3411 | } | |||
3412 | ||||
3413 | ctk_style_context_restore (context); | |||
3414 | ||||
3415 | return retval; | |||
3416 | } | |||
3417 | ||||
3418 | static gboolean | |||
3419 | panel_toplevel_button_press_event (CtkWidget *widget, | |||
3420 | CdkEventButton *event) | |||
3421 | { | |||
3422 | PanelToplevel *toplevel; | |||
3423 | CtkWidget *event_widget; | |||
3424 | ||||
3425 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (widget)"); return ((0)); } } while (0); | |||
3426 | ||||
3427 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3428 | ||||
3429 | if (event->button != 1 && event->button != 2) | |||
3430 | return FALSE(0); | |||
3431 | ||||
3432 | if (toplevel->priv->animating) | |||
3433 | return FALSE(0); | |||
3434 | ||||
3435 | /* Get the mouse-button modifier from croma so that only intentional | |||
3436 | * moves are considered. We don't this for non-expanded panels since we | |||
3437 | * only have the handles that the user can grab. */ | |||
3438 | if ((toplevel->priv->expand || toplevel->priv->attached) && | |||
3439 | (event->state & CDK_MODIFIER_MASK) != panel_bindings_get_mouse_button_modifier_keymask ()) | |||
3440 | return FALSE(0); | |||
3441 | ||||
3442 | cdk_window_get_user_data (event->window, (gpointer)&event_widget); | |||
3443 | g_assert (CTK_IS_WIDGET (event_widget))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((event_widget)); GType __t = ((ctk_widget_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 3443 , ((const char*) (__func__)), "CTK_IS_WIDGET (event_widget)") ; } while (0); | |||
3444 | ctk_widget_translate_coordinates (event_widget, | |||
3445 | widget, | |||
3446 | event->x, | |||
3447 | event->y, | |||
3448 | &toplevel->priv->drag_offset_x, | |||
3449 | &toplevel->priv->drag_offset_y); | |||
3450 | ||||
3451 | panel_toplevel_begin_grab_op (toplevel, PANEL_GRAB_OP_MOVE, FALSE(0), event->time); | |||
3452 | ||||
3453 | return TRUE(!(0)); | |||
3454 | } | |||
3455 | ||||
3456 | static gboolean | |||
3457 | panel_toplevel_button_release_event (CtkWidget *widget, | |||
3458 | CdkEventButton *event) | |||
3459 | { | |||
3460 | PanelToplevel *toplevel; | |||
3461 | ||||
3462 | if (event->button != 1 && event->button != 2) | |||
3463 | return FALSE(0); | |||
3464 | ||||
3465 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3466 | ||||
3467 | if (toplevel->priv->grab_op == PANEL_GRAB_OP_NONE) | |||
3468 | return FALSE(0); | |||
3469 | ||||
3470 | if (toplevel->priv->grab_is_keyboard) | |||
3471 | return FALSE(0); | |||
3472 | ||||
3473 | panel_toplevel_end_grab_op (toplevel, event->time); | |||
3474 | ||||
3475 | return TRUE(!(0)); | |||
3476 | } | |||
3477 | ||||
3478 | static gboolean | |||
3479 | panel_toplevel_configure_event (CtkWidget *widget, | |||
3480 | CdkEventConfigure *event) | |||
3481 | { | |||
3482 | PanelToplevel *toplevel; | |||
3483 | ||||
3484 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3485 | ||||
3486 | set_background_region (toplevel); | |||
3487 | ||||
3488 | return TRUE(!(0)); | |||
3489 | } | |||
3490 | ||||
3491 | static gboolean | |||
3492 | panel_toplevel_key_press_event (CtkWidget *widget, | |||
3493 | CdkEventKey *event) | |||
3494 | { | |||
3495 | PanelToplevel *toplevel = (PanelToplevel *) widget; | |||
3496 | ||||
3497 | if (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE && | |||
3498 | panel_toplevel_handle_grab_op_key_event (toplevel, event)) | |||
3499 | return TRUE(!(0)); | |||
3500 | ||||
3501 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->key_press_event) | |||
3502 | return CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->key_press_event (widget, event); | |||
3503 | ||||
3504 | return FALSE(0); | |||
3505 | } | |||
3506 | ||||
3507 | static void | |||
3508 | panel_toplevel_state_flags_changed (CtkWidget *widget, | |||
3509 | CtkStateFlags previous_state) | |||
3510 | { | |||
3511 | CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->state_flags_changed (widget, | |||
3512 | previous_state); | |||
3513 | ||||
3514 | set_background_default_style (widget); | |||
3515 | } | |||
3516 | ||||
3517 | static gboolean | |||
3518 | panel_toplevel_motion_notify_event (CtkWidget *widget, | |||
3519 | CdkEventMotion *event) | |||
3520 | { | |||
3521 | if (cdk_event_get_screen ((CdkEvent *)event) == | |||
3522 | ctk_window_get_screen (CTK_WINDOW (widget)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_window_get_type ())))))))) | |||
3523 | return panel_toplevel_handle_grab_op_motion_event ( | |||
3524 | PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))), event); | |||
3525 | else | |||
3526 | return FALSE(0); | |||
3527 | } | |||
3528 | ||||
3529 | static gboolean | |||
3530 | panel_toplevel_animation_timeout (PanelToplevel *toplevel) | |||
3531 | { | |||
3532 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3533 | ||||
3534 | if (!toplevel->priv->animating) { | |||
3535 | toplevel->priv->animation_end_x = 0xdead; | |||
3536 | toplevel->priv->animation_end_y = 0xdead; | |||
3537 | toplevel->priv->animation_end_width = 0xdead; | |||
3538 | toplevel->priv->animation_end_height = 0xdead; | |||
3539 | toplevel->priv->animation_start_time.tv_sec = 0xdead; | |||
3540 | toplevel->priv->animation_start_time.tv_usec = 0xdead; | |||
3541 | toplevel->priv->animation_end_time.tv_sec = 0xdead; | |||
3542 | toplevel->priv->animation_end_time.tv_usec = 0xdead; | |||
3543 | toplevel->priv->animation_timeout = 0; | |||
3544 | toplevel->priv->initial_animation_done = TRUE(!(0)); | |||
3545 | } | |||
3546 | ||||
3547 | return toplevel->priv->animating; | |||
3548 | } | |||
3549 | ||||
3550 | static long | |||
3551 | panel_toplevel_get_animation_time (PanelToplevel *toplevel) | |||
3552 | { | |||
3553 | /* The number of seconds to complete the animation. | |||
3554 | */ | |||
3555 | #define ANIMATION_TIME_FAST 0.4 | |||
3556 | #define ANIMATION_TIME_MEDIUM 1.2 | |||
3557 | #define ANIMATION_TIME_SLOW 2.0 | |||
3558 | ||||
3559 | long t; | |||
3560 | ||||
3561 | switch (toplevel->priv->animation_speed) { | |||
3562 | case PANEL_ANIMATION_SLOW: | |||
3563 | t = ANIMATION_TIME_SLOW * G_USEC_PER_SEC1000000; | |||
3564 | break; | |||
3565 | case PANEL_ANIMATION_MEDIUM: | |||
3566 | t = ANIMATION_TIME_MEDIUM * G_USEC_PER_SEC1000000; | |||
3567 | break; | |||
3568 | case PANEL_ANIMATION_FAST: | |||
3569 | t = ANIMATION_TIME_FAST * G_USEC_PER_SEC1000000; | |||
3570 | break; | |||
3571 | default: | |||
3572 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 3572, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
3573 | break; | |||
3574 | } | |||
3575 | ||||
3576 | return t; | |||
3577 | ||||
3578 | #undef ANIMATION_TIME_FAST | |||
3579 | #undef ANIMATION_TIME_MEDIUM | |||
3580 | #undef ANIMATION_TIME_SLOW | |||
3581 | } | |||
3582 | ||||
3583 | static void | |||
3584 | panel_toplevel_calculate_animation_end_geometry (PanelToplevel *toplevel) | |||
3585 | { | |||
3586 | CdkRectangle monitor_geom; | |||
3587 | ||||
3588 | toplevel->priv->animation_end_x = toplevel->priv->x; | |||
3589 | toplevel->priv->animation_end_y = toplevel->priv->y; | |||
3590 | toplevel->priv->animation_end_width = -1; | |||
3591 | toplevel->priv->animation_end_height = -1; | |||
3592 | ||||
3593 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
3594 | ||||
3595 | if (!toplevel->priv->expand) { | |||
3596 | ||||
3597 | if (toplevel->priv->x_centered) | |||
3598 | toplevel->priv->animation_end_x = | |||
3599 | (monitor_geom.width - toplevel->priv->geometry.width) / 2; | |||
3600 | if (toplevel->priv->y_centered) | |||
3601 | toplevel->priv->animation_end_y = | |||
3602 | (monitor_geom.height - toplevel->priv->geometry.height) / 2; | |||
3603 | } | |||
3604 | ||||
3605 | /* we consider the toplevels which are in the initial animation stage | |||
3606 | * as in a normal state */ | |||
3607 | if (toplevel->priv->state == PANEL_STATE_NORMAL || | |||
3608 | (!toplevel->priv->initial_animation_done && | |||
3609 | !toplevel->priv->auto_hide)) | |||
3610 | panel_toplevel_update_normal_position (toplevel, | |||
3611 | &toplevel->priv->animation_end_x, | |||
3612 | &toplevel->priv->animation_end_y, | |||
3613 | &toplevel->priv->animation_end_width, | |||
3614 | &toplevel->priv->animation_end_height); | |||
3615 | ||||
3616 | else if (toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) | |||
3617 | panel_toplevel_update_auto_hide_position (toplevel, | |||
3618 | &toplevel->priv->animation_end_x, | |||
3619 | &toplevel->priv->animation_end_y, | |||
3620 | &toplevel->priv->animation_end_width, | |||
3621 | &toplevel->priv->animation_end_height, | |||
3622 | TRUE(!(0))); | |||
3623 | else | |||
3624 | panel_toplevel_update_hidden_position (toplevel, | |||
3625 | &toplevel->priv->animation_end_x, | |||
3626 | &toplevel->priv->animation_end_y, | |||
3627 | &toplevel->priv->animation_end_width, | |||
3628 | &toplevel->priv->animation_end_height); | |||
3629 | } | |||
3630 | ||||
3631 | static void | |||
3632 | panel_toplevel_start_animation (PanelToplevel *toplevel) | |||
3633 | { | |||
3634 | CtkRequisition requisition; | |||
3635 | int deltax, deltay, deltaw = 0, deltah = 0; | |||
3636 | int cur_x = -1, cur_y = -1; | |||
3637 | long t; | |||
3638 | ||||
3639 | panel_toplevel_calculate_animation_end_geometry (toplevel); | |||
3640 | ||||
3641 | toplevel->priv->animating = TRUE(!(0)); | |||
3642 | ||||
3643 | panel_toplevel_update_struts (toplevel, TRUE(!(0))); | |||
3644 | #ifdef HAVE_X111 | |||
3645 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) { | |||
3646 | panel_struts_update_toplevel_geometry (toplevel, | |||
3647 | &toplevel->priv->animation_end_x, | |||
3648 | &toplevel->priv->animation_end_y, | |||
3649 | &toplevel->priv->animation_end_width, | |||
3650 | &toplevel->priv->animation_end_height); | |||
3651 | } | |||
3652 | #endif // HAVE_X11 | |||
3653 | panel_toplevel_update_struts (toplevel, FALSE(0)); | |||
3654 | ||||
3655 | cdk_window_get_origin (ctk_widget_get_window (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))), &cur_x, &cur_y); | |||
3656 | ||||
3657 | cur_x -= panel_multimonitor_x (toplevel->priv->monitor); | |||
3658 | cur_y -= panel_multimonitor_y (toplevel->priv->monitor); | |||
3659 | ||||
3660 | deltax = toplevel->priv->animation_end_x - cur_x; | |||
3661 | deltay = toplevel->priv->animation_end_y - cur_y; | |||
3662 | ||||
3663 | ctk_widget_get_preferred_size (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), &requisition, NULL((void*)0)); | |||
3664 | ||||
3665 | if (toplevel->priv->animation_end_width != -1) | |||
3666 | deltaw = toplevel->priv->animation_end_width - requisition.width; | |||
3667 | ||||
3668 | if (toplevel->priv->animation_end_height != -1) | |||
3669 | deltah = toplevel->priv->animation_end_height - requisition.height; | |||
3670 | ||||
3671 | if (deltax == 0 && deltay == 0 && deltaw == 0 && deltah == 0) { | |||
3672 | toplevel->priv->animation_end_x = -1; | |||
3673 | toplevel->priv->animation_end_y = -1; | |||
3674 | toplevel->priv->animation_end_width = -1; | |||
3675 | toplevel->priv->animation_end_height = -1; | |||
3676 | toplevel->priv->animating = FALSE(0); | |||
3677 | return; | |||
3678 | } | |||
3679 | ||||
3680 | if (toplevel->priv->attached) { | |||
3681 | /* Re-map unmapped attached toplevels */ | |||
3682 | if (!ctk_widget_get_visible (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))))) | |||
3683 | ctk_widget_set_visible (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), TRUE(!(0))); | |||
3684 | ||||
3685 | if (!ctk_widget_get_mapped (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))))) | |||
3686 | ctk_widget_map (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3687 | ||||
3688 | ctk_window_present (CTK_WINDOW (toplevel->priv->attach_toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->attach_toplevel)), ((ctk_window_get_type ()))))))); | |||
3689 | } | |||
3690 | ||||
3691 | g_get_current_time (&toplevel->priv->animation_start_time); | |||
3692 | ||||
3693 | t = panel_toplevel_get_animation_time (toplevel); | |||
3694 | g_get_current_time (&toplevel->priv->animation_end_time); | |||
3695 | g_time_val_add (&toplevel->priv->animation_end_time, t); | |||
3696 | ||||
3697 | if (!toplevel->priv->animation_timeout) | |||
3698 | toplevel->priv->animation_timeout = | |||
3699 | g_timeout_add (20, (GSourceFunc) panel_toplevel_animation_timeout, toplevel); | |||
3700 | } | |||
3701 | ||||
3702 | void | |||
3703 | panel_toplevel_hide (PanelToplevel *toplevel, | |||
3704 | gboolean auto_hide, | |||
3705 | CtkDirectionType direction) | |||
3706 | { | |||
3707 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
3708 | ||||
3709 | if (toplevel->priv->state != PANEL_STATE_NORMAL) | |||
3710 | return; | |||
3711 | ||||
3712 | g_signal_emit (toplevel, toplevel_signals [HIDE_SIGNAL], 0); | |||
3713 | ||||
3714 | if (toplevel->priv->attach_toplevel) | |||
3715 | panel_toplevel_pop_autohide_disabler (toplevel->priv->attach_toplevel); | |||
3716 | ||||
3717 | if (auto_hide) | |||
3718 | toplevel->priv->state = PANEL_STATE_AUTO_HIDDEN; | |||
3719 | else { | |||
3720 | if (direction == -1) { | |||
3721 | if (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
3722 | direction = CTK_DIR_UP; | |||
3723 | else | |||
3724 | direction = CTK_DIR_LEFT; | |||
3725 | } | |||
3726 | ||||
3727 | switch (direction) { | |||
3728 | case CTK_DIR_UP: | |||
3729 | g_return_if_fail (toplevel->priv->orientation & PANEL_VERTICAL_MASK)do { if ((toplevel->priv->orientation & (PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel->priv->orientation & PANEL_VERTICAL_MASK" ); return; } } while (0); | |||
3730 | toplevel->priv->state = PANEL_STATE_HIDDEN_UP; | |||
3731 | break; | |||
3732 | case CTK_DIR_DOWN: | |||
3733 | g_return_if_fail (toplevel->priv->orientation & PANEL_VERTICAL_MASK)do { if ((toplevel->priv->orientation & (PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel->priv->orientation & PANEL_VERTICAL_MASK" ); return; } } while (0); | |||
3734 | toplevel->priv->state = PANEL_STATE_HIDDEN_DOWN; | |||
3735 | break; | |||
3736 | case CTK_DIR_LEFT: | |||
3737 | g_return_if_fail (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)do { if ((toplevel->priv->orientation & (PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel->priv->orientation & PANEL_HORIZONTAL_MASK" ); return; } } while (0); | |||
3738 | toplevel->priv->state = PANEL_STATE_HIDDEN_LEFT; | |||
3739 | break; | |||
3740 | case CTK_DIR_RIGHT: | |||
3741 | g_return_if_fail (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)do { if ((toplevel->priv->orientation & (PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "toplevel->priv->orientation & PANEL_HORIZONTAL_MASK" ); return; } } while (0); | |||
3742 | toplevel->priv->state = PANEL_STATE_HIDDEN_RIGHT; | |||
3743 | break; | |||
3744 | default: | |||
3745 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 3745, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
3746 | break; | |||
3747 | } | |||
3748 | ||||
3749 | panel_toplevel_update_hide_buttons (toplevel); | |||
3750 | } | |||
3751 | ||||
3752 | if (toplevel->priv->anicafe && ctk_widget_get_realized (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))))) { | |||
3753 | panel_toplevel_start_animation (toplevel); | |||
3754 | } | |||
3755 | ||||
3756 | /* if the toplevel is attached (-> drawer), hide it after the animation | |||
3757 | * this hides the hide button properly as well */ | |||
3758 | if (toplevel->priv->attached) { | |||
3759 | ctk_widget_hide (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3760 | } | |||
3761 | ||||
3762 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3763 | } | |||
3764 | ||||
3765 | static gboolean | |||
3766 | panel_toplevel_auto_hide_timeout_handler (PanelToplevel *toplevel) | |||
3767 | { | |||
3768 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
3769 | ||||
3770 | if (panel_toplevel_get_autohide_disabled (toplevel)) { | |||
3771 | toplevel->priv->hide_timeout = 0; | |||
3772 | return FALSE(0); | |||
3773 | } | |||
3774 | ||||
3775 | /* keep coming back until the animation has finished. | |||
3776 | * FIXME: we should really remove the timeout/idle | |||
3777 | * completely and re-instate it when the | |||
3778 | * animation has finished. | |||
3779 | */ | |||
3780 | if (toplevel->priv->animating) | |||
3781 | return TRUE(!(0)); | |||
3782 | ||||
3783 | panel_toplevel_hide (toplevel, TRUE(!(0)), -1); | |||
3784 | ||||
3785 | toplevel->priv->hide_timeout = 0; | |||
3786 | ||||
3787 | return FALSE(0); | |||
3788 | } | |||
3789 | ||||
3790 | void | |||
3791 | panel_toplevel_unhide (PanelToplevel *toplevel) | |||
3792 | { | |||
3793 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
3794 | ||||
3795 | if (toplevel->priv->state == PANEL_STATE_NORMAL) | |||
3796 | return; | |||
3797 | ||||
3798 | toplevel->priv->state = PANEL_STATE_NORMAL; | |||
3799 | ||||
3800 | panel_toplevel_update_hide_buttons (toplevel); | |||
3801 | ||||
3802 | if (toplevel->priv->attach_toplevel) | |||
3803 | panel_toplevel_push_autohide_disabler (toplevel->priv->attach_toplevel); | |||
3804 | ||||
3805 | if (toplevel->priv->anicafe && ctk_widget_get_realized (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))))) { | |||
3806 | panel_toplevel_start_animation (toplevel); | |||
3807 | } | |||
3808 | ||||
3809 | /* if the toplevel is attached (-> drawer), unhide it after the animation | |||
3810 | * (same as for hide) */ | |||
3811 | if (toplevel->priv->attached) { | |||
3812 | ctk_widget_show (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3813 | } | |||
3814 | ||||
3815 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
3816 | ||||
3817 | if (!toplevel->priv->anicafe) | |||
3818 | g_signal_emit (toplevel, toplevel_signals [UNHIDE_SIGNAL], 0); | |||
3819 | } | |||
3820 | ||||
3821 | static gboolean | |||
3822 | panel_toplevel_auto_unhide_timeout_handler (PanelToplevel *toplevel) | |||
3823 | { | |||
3824 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
3825 | ||||
3826 | /* keep coming back until the animation has finished. | |||
3827 | * FIXME: we should really remove the timeout/idle | |||
3828 | * completely and re-instate it when the | |||
3829 | * animation has finished. | |||
3830 | */ | |||
3831 | if (toplevel->priv->animating) | |||
3832 | return TRUE(!(0)); | |||
3833 | ||||
3834 | if (!toplevel->priv->anicafe) | |||
3835 | toplevel->priv->initial_animation_done = TRUE(!(0)); | |||
3836 | ||||
3837 | /* initial animation for auto-hidden panels: we need to unhide and hide | |||
3838 | * again to get at the right size */ | |||
3839 | if (!toplevel->priv->initial_animation_done && | |||
3840 | toplevel->priv->auto_hide) { | |||
3841 | toplevel->priv->unhide_timeout = 0; | |||
3842 | panel_toplevel_unhide (toplevel); | |||
3843 | panel_toplevel_hide (toplevel, TRUE(!(0)), -1); | |||
3844 | return FALSE(0); | |||
3845 | } | |||
3846 | ||||
3847 | if (!panel_toplevel_contains_pointer (toplevel) && | |||
3848 | toplevel->priv->auto_hide) { | |||
3849 | toplevel->priv->unhide_timeout = 0; | |||
3850 | return FALSE(0); | |||
3851 | } | |||
3852 | ||||
3853 | panel_toplevel_unhide (toplevel); | |||
3854 | ||||
3855 | toplevel->priv->unhide_timeout = 0; | |||
3856 | ||||
3857 | return FALSE(0); | |||
3858 | } | |||
3859 | ||||
3860 | void | |||
3861 | panel_toplevel_queue_auto_hide (PanelToplevel *toplevel) | |||
3862 | { | |||
3863 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
3864 | ||||
3865 | if (!toplevel->priv->auto_hide || | |||
3866 | panel_toplevel_contains_pointer (toplevel) || | |||
3867 | panel_toplevel_get_autohide_disabled (toplevel)) | |||
3868 | return; | |||
3869 | ||||
3870 | if (toplevel->priv->unhide_timeout) | |||
3871 | g_source_remove (toplevel->priv->unhide_timeout); | |||
3872 | toplevel->priv->unhide_timeout = 0; | |||
3873 | ||||
3874 | if (toplevel->priv->hide_timeout || | |||
3875 | toplevel->priv->state != PANEL_STATE_NORMAL) | |||
3876 | return; | |||
3877 | ||||
3878 | if (toplevel->priv->hide_delay > 0) | |||
3879 | toplevel->priv->hide_timeout = | |||
3880 | g_timeout_add (toplevel->priv->hide_delay, | |||
3881 | (GSourceFunc) panel_toplevel_auto_hide_timeout_handler, | |||
3882 | toplevel); | |||
3883 | else | |||
3884 | toplevel->priv->hide_timeout = | |||
3885 | g_idle_add ((GSourceFunc) panel_toplevel_auto_hide_timeout_handler, | |||
3886 | toplevel); | |||
3887 | } | |||
3888 | ||||
3889 | void | |||
3890 | panel_toplevel_queue_auto_unhide (PanelToplevel *toplevel) | |||
3891 | { | |||
3892 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
3893 | ||||
3894 | if (toplevel->priv->unhide_timeout) | |||
3895 | return; | |||
3896 | ||||
3897 | if (toplevel->priv->hide_timeout) | |||
3898 | g_source_remove (toplevel->priv->hide_timeout); | |||
3899 | toplevel->priv->hide_timeout = 0; | |||
3900 | ||||
3901 | if (toplevel->priv->state != PANEL_STATE_AUTO_HIDDEN) | |||
3902 | return; | |||
3903 | ||||
3904 | if (toplevel->priv->unhide_delay > 0) | |||
3905 | toplevel->priv->unhide_timeout = | |||
3906 | g_timeout_add (toplevel->priv->unhide_delay, | |||
3907 | (GSourceFunc) panel_toplevel_auto_unhide_timeout_handler, | |||
3908 | toplevel); | |||
3909 | else | |||
3910 | toplevel->priv->unhide_timeout = | |||
3911 | g_idle_add ((GSourceFunc) panel_toplevel_auto_unhide_timeout_handler, | |||
3912 | toplevel); | |||
3913 | } | |||
3914 | ||||
3915 | void | |||
3916 | panel_toplevel_queue_initial_unhide (PanelToplevel *toplevel) | |||
3917 | { | |||
3918 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
3919 | ||||
3920 | if (toplevel->priv->initial_animation_done) | |||
3921 | return; | |||
3922 | ||||
3923 | if (toplevel->priv->unhide_timeout) | |||
3924 | return; | |||
3925 | ||||
3926 | toplevel->priv->unhide_timeout = | |||
3927 | g_idle_add ((GSourceFunc) panel_toplevel_auto_unhide_timeout_handler, | |||
3928 | toplevel); | |||
3929 | } | |||
3930 | ||||
3931 | static gboolean | |||
3932 | panel_toplevel_enter_notify_event (CtkWidget *widget, | |||
3933 | CdkEventCrossing *event) | |||
3934 | { | |||
3935 | PanelToplevel *toplevel; | |||
3936 | ||||
3937 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (widget)"); return ((0)); } } while (0); | |||
3938 | ||||
3939 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3940 | ||||
3941 | if (toplevel->priv->auto_hide && event->detail != CDK_NOTIFY_INFERIOR) | |||
3942 | panel_toplevel_queue_auto_unhide (toplevel); | |||
3943 | ||||
3944 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->enter_notify_event) | |||
3945 | return CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->enter_notify_event (widget, event); | |||
3946 | ||||
3947 | return FALSE(0); | |||
3948 | } | |||
3949 | ||||
3950 | static gboolean | |||
3951 | panel_toplevel_leave_notify_event (CtkWidget *widget, | |||
3952 | CdkEventCrossing *event) | |||
3953 | { | |||
3954 | PanelToplevel *toplevel; | |||
3955 | ||||
3956 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (widget), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((widget)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (widget)"); return ((0)); } } while (0); | |||
3957 | ||||
3958 | toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3959 | ||||
3960 | if (toplevel->priv->auto_hide && event->detail != CDK_NOTIFY_INFERIOR) | |||
3961 | panel_toplevel_queue_auto_hide (toplevel); | |||
3962 | ||||
3963 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->leave_notify_event) | |||
3964 | return CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->leave_notify_event (widget, event); | |||
3965 | ||||
3966 | return FALSE(0); | |||
3967 | } | |||
3968 | ||||
3969 | static gboolean | |||
3970 | panel_toplevel_focus_in_event (CtkWidget *widget, | |||
3971 | CdkEventFocus *event) | |||
3972 | { | |||
3973 | PanelToplevel *toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3974 | ||||
3975 | if (toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) | |||
3976 | panel_toplevel_unhide (toplevel); | |||
3977 | ||||
3978 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->focus_in_event) | |||
3979 | return CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->focus_in_event (widget, event); | |||
3980 | ||||
3981 | return FALSE(0); | |||
3982 | } | |||
3983 | ||||
3984 | static gboolean | |||
3985 | panel_toplevel_focus_out_event (CtkWidget *widget, | |||
3986 | CdkEventFocus *event) | |||
3987 | { | |||
3988 | PanelToplevel *toplevel = PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ())))))); | |||
3989 | ||||
3990 | /* It appears that sometimes we don't get a leave notify event, | |||
3991 | but just a focus in/out, so queue the autohide in that case. | |||
3992 | If the pointer is inside the panel then obviously we won't hide */ | |||
3993 | if (toplevel->priv->auto_hide) | |||
3994 | panel_toplevel_queue_auto_hide (toplevel); | |||
3995 | ||||
3996 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->focus_out_event) | |||
3997 | return CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->focus_out_event (widget, event); | |||
3998 | ||||
3999 | return FALSE(0); | |||
4000 | } | |||
4001 | ||||
4002 | static void | |||
4003 | panel_toplevel_style_updated (CtkWidget *widget) | |||
4004 | { | |||
4005 | panel_toplevel_update_hide_buttons (PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ()))))))); | |||
4006 | ||||
4007 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->style_updated) | |||
4008 | CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->style_updated (widget); | |||
4009 | ||||
4010 | set_background_default_style (widget); | |||
4011 | } | |||
4012 | ||||
4013 | static void | |||
4014 | panel_toplevel_drag_threshold_changed (PanelToplevel *toplevel) | |||
4015 | { | |||
4016 | int threshold; | |||
4017 | ||||
4018 | threshold = 0; | |||
4019 | g_object_get (G_OBJECT (toplevel->priv->ctk_settings)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->ctk_settings)), (((GType) ((20) << (2)))))))), | |||
4020 | "ctk-dnd-drag-threshold", &threshold, | |||
4021 | NULL((void*)0)); | |||
4022 | ||||
4023 | if (threshold) | |||
4024 | toplevel->priv->snap_tolerance = threshold * SNAP_TOLERANCE_FACTOR6; | |||
4025 | } | |||
4026 | ||||
4027 | static void | |||
4028 | panel_toplevel_update_ctk_settings (PanelToplevel *toplevel) | |||
4029 | { | |||
4030 | if (toplevel->priv->ctk_settings) | |||
4031 | g_signal_handlers_disconnect_by_func (toplevel->priv->ctk_settings,g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)) | |||
4032 | G_CALLBACK (panel_toplevel_drag_threshold_changed),g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)) | |||
4033 | toplevel)g_signal_handlers_disconnect_matched ((toplevel->priv-> ctk_settings), (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA ), 0, 0, ((void*)0), (((GCallback) (panel_toplevel_drag_threshold_changed ))), (toplevel)); | |||
4034 | ||||
4035 | toplevel->priv->ctk_settings = ctk_widget_get_settings (CTK_WIDGET (toplevel->priv->panel_widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->panel_widget)), ((ctk_widget_get_type ()))))))); | |||
4036 | ||||
4037 | g_signal_connect_swapped (G_OBJECT (toplevel->priv->ctk_settings),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel->priv->ctk_settings)), (( (GType) ((20) << (2))))))))), ("notify::ctk-dnd-drag-threshold" ), (((GCallback) (panel_toplevel_drag_threshold_changed))), ( toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
4038 | "notify::ctk-dnd-drag-threshold",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel->priv->ctk_settings)), (( (GType) ((20) << (2))))))))), ("notify::ctk-dnd-drag-threshold" ), (((GCallback) (panel_toplevel_drag_threshold_changed))), ( toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
4039 | G_CALLBACK (panel_toplevel_drag_threshold_changed),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel->priv->ctk_settings)), (( (GType) ((20) << (2))))))))), ("notify::ctk-dnd-drag-threshold" ), (((GCallback) (panel_toplevel_drag_threshold_changed))), ( toplevel), ((void*)0), G_CONNECT_SWAPPED) | |||
4040 | toplevel)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel->priv->ctk_settings)), (( (GType) ((20) << (2))))))))), ("notify::ctk-dnd-drag-threshold" ), (((GCallback) (panel_toplevel_drag_threshold_changed))), ( toplevel), ((void*)0), G_CONNECT_SWAPPED); | |||
4041 | ||||
4042 | panel_toplevel_drag_threshold_changed (toplevel); | |||
4043 | } | |||
4044 | ||||
4045 | static void | |||
4046 | panel_toplevel_screen_changed (CtkWidget *widget, | |||
4047 | CdkScreen *previous_screen) | |||
4048 | { | |||
4049 | panel_toplevel_update_ctk_settings (PANEL_TOPLEVEL (widget)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((panel_toplevel_get_type ()))))))); | |||
4050 | ||||
4051 | if (CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->screen_changed) | |||
4052 | CTK_WIDGET_CLASS (panel_toplevel_parent_class)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), ((ctk_widget_get_type ()) )))))->screen_changed (widget, previous_screen); | |||
4053 | ||||
4054 | ctk_widget_queue_resize (widget); | |||
4055 | } | |||
4056 | ||||
4057 | static void | |||
4058 | panel_toplevel_set_property (GObject *object, | |||
4059 | guint prop_id, | |||
4060 | const GValue *value, | |||
4061 | GParamSpec *pspec) | |||
4062 | { | |||
4063 | PanelToplevel *toplevel; | |||
4064 | ||||
4065 | g_return_if_fail (PANEL_IS_TOPLEVEL (object))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((object)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (object)"); return; } } while (0); | |||
4066 | ||||
4067 | toplevel = PANEL_TOPLEVEL (object)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((panel_toplevel_get_type ())))))); | |||
4068 | ||||
4069 | switch (prop_id) { | |||
4070 | case PROP_NAME: | |||
4071 | panel_toplevel_set_name (toplevel, g_value_get_string (value)); | |||
4072 | break; | |||
4073 | case PROP_SETTINGS_PATH: | |||
4074 | panel_toplevel_set_settings_path (toplevel, g_value_get_string (value)); | |||
4075 | break; | |||
4076 | case PROP_EXPAND: | |||
4077 | panel_toplevel_set_expand (toplevel, g_value_get_boolean (value)); | |||
4078 | break; | |||
4079 | case PROP_ORIENTATION: | |||
4080 | panel_toplevel_set_orientation (toplevel, g_value_get_enum (value)); | |||
4081 | break; | |||
4082 | case PROP_SIZE: | |||
4083 | panel_toplevel_set_size (toplevel, g_value_get_int (value)); | |||
4084 | break; | |||
4085 | case PROP_X: | |||
4086 | panel_toplevel_set_x (toplevel, | |||
4087 | g_value_get_int (value), | |||
4088 | toplevel->priv->x_right, | |||
4089 | toplevel->priv->x_centered); | |||
4090 | break; | |||
4091 | case PROP_X_RIGHT: | |||
4092 | panel_toplevel_set_x (toplevel, | |||
4093 | toplevel->priv->x, | |||
4094 | g_value_get_int (value), | |||
4095 | toplevel->priv->x_centered); | |||
4096 | break; | |||
4097 | case PROP_X_CENTERED: | |||
4098 | panel_toplevel_set_x (toplevel, | |||
4099 | toplevel->priv->x, | |||
4100 | toplevel->priv->x_right, | |||
4101 | g_value_get_boolean (value)); | |||
4102 | break; | |||
4103 | case PROP_Y: | |||
4104 | panel_toplevel_set_y (toplevel, | |||
4105 | g_value_get_int (value), | |||
4106 | toplevel->priv->y_bottom, | |||
4107 | toplevel->priv->y_centered); | |||
4108 | break; | |||
4109 | case PROP_Y_BOTTOM: | |||
4110 | panel_toplevel_set_y (toplevel, | |||
4111 | toplevel->priv->y, | |||
4112 | g_value_get_int (value), | |||
4113 | toplevel->priv->y_centered); | |||
4114 | break; | |||
4115 | case PROP_Y_CENTERED: | |||
4116 | panel_toplevel_set_y (toplevel, | |||
4117 | toplevel->priv->y, | |||
4118 | toplevel->priv->y_bottom, | |||
4119 | g_value_get_boolean (value)); | |||
4120 | break; | |||
4121 | case PROP_MONITOR: | |||
4122 | panel_toplevel_set_monitor (toplevel, g_value_get_int (value)); | |||
4123 | break; | |||
4124 | case PROP_AUTOHIDE: | |||
4125 | panel_toplevel_set_auto_hide (toplevel, g_value_get_boolean (value)); | |||
4126 | break; | |||
4127 | case PROP_HIDE_DELAY: | |||
4128 | panel_toplevel_set_hide_delay (toplevel, g_value_get_int (value)); | |||
4129 | break; | |||
4130 | case PROP_UNHIDE_DELAY: | |||
4131 | panel_toplevel_set_unhide_delay (toplevel, g_value_get_int (value)); | |||
4132 | break; | |||
4133 | case PROP_AUTOHIDE_SIZE: | |||
4134 | panel_toplevel_set_auto_hide_size (toplevel, g_value_get_int (value)); | |||
4135 | break; | |||
4136 | case PROP_ANICAFE: | |||
4137 | panel_toplevel_set_anicafe (toplevel, g_value_get_boolean (value)); | |||
4138 | break; | |||
4139 | case PROP_ANIMATION_SPEED: | |||
4140 | panel_toplevel_set_animation_speed (toplevel, g_value_get_enum (value)); | |||
4141 | break; | |||
4142 | case PROP_BUTTONS_ENABLED: | |||
4143 | panel_toplevel_set_enable_buttons (toplevel, g_value_get_boolean (value)); | |||
4144 | break; | |||
4145 | case PROP_ARROWS_ENABLED: | |||
4146 | panel_toplevel_set_enable_arrows (toplevel, g_value_get_boolean (value)); | |||
4147 | break; | |||
4148 | default: | |||
4149 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "panel-toplevel.c", 4149, ("property"), _glib__property_id, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); | |||
4150 | break; | |||
4151 | } | |||
4152 | } | |||
4153 | ||||
4154 | static void | |||
4155 | panel_toplevel_get_property (GObject *object, | |||
4156 | guint prop_id, | |||
4157 | GValue *value, | |||
4158 | GParamSpec *pspec) | |||
4159 | { | |||
4160 | PanelToplevel *toplevel; | |||
4161 | ||||
4162 | g_return_if_fail (PANEL_IS_TOPLEVEL (object))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((object)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (object)"); return; } } while (0); | |||
4163 | ||||
4164 | toplevel = PANEL_TOPLEVEL (object)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((panel_toplevel_get_type ())))))); | |||
4165 | ||||
4166 | switch (prop_id) { | |||
4167 | case PROP_NAME: | |||
4168 | g_value_set_string (value, panel_toplevel_get_name (toplevel)); | |||
4169 | break; | |||
4170 | case PROP_SETTINGS_PATH: | |||
4171 | g_value_set_string (value, toplevel->priv->settings_path); | |||
4172 | break; | |||
4173 | case PROP_EXPAND: | |||
4174 | g_value_set_boolean (value, toplevel->priv->expand); | |||
4175 | break; | |||
4176 | case PROP_ORIENTATION: | |||
4177 | g_value_set_enum (value, toplevel->priv->orientation); | |||
4178 | break; | |||
4179 | case PROP_SIZE: | |||
4180 | g_value_set_int (value, toplevel->priv->size); | |||
4181 | break; | |||
4182 | case PROP_X: | |||
4183 | g_value_set_int (value, toplevel->priv->x); | |||
4184 | break; | |||
4185 | case PROP_X_RIGHT: | |||
4186 | g_value_set_int (value, toplevel->priv->x_right); | |||
4187 | break; | |||
4188 | case PROP_X_CENTERED: | |||
4189 | g_value_set_boolean (value, toplevel->priv->x_centered); | |||
4190 | break; | |||
4191 | case PROP_Y: | |||
4192 | g_value_set_int (value, toplevel->priv->y); | |||
4193 | break; | |||
4194 | case PROP_Y_BOTTOM: | |||
4195 | g_value_set_int (value, toplevel->priv->y_bottom); | |||
4196 | break; | |||
4197 | case PROP_Y_CENTERED: | |||
4198 | g_value_set_boolean (value, toplevel->priv->y_centered); | |||
4199 | break; | |||
4200 | case PROP_MONITOR: | |||
4201 | g_value_set_int (value, toplevel->priv->monitor); | |||
4202 | break; | |||
4203 | case PROP_AUTOHIDE: | |||
4204 | g_value_set_boolean (value, toplevel->priv->auto_hide); | |||
4205 | break; | |||
4206 | case PROP_HIDE_DELAY: | |||
4207 | g_value_set_int (value, toplevel->priv->hide_delay); | |||
4208 | break; | |||
4209 | case PROP_UNHIDE_DELAY: | |||
4210 | g_value_set_int (value, toplevel->priv->unhide_delay); | |||
4211 | break; | |||
4212 | case PROP_AUTOHIDE_SIZE: | |||
4213 | g_value_set_int (value, toplevel->priv->auto_hide_size); | |||
4214 | break; | |||
4215 | case PROP_ANICAFE: | |||
4216 | g_value_set_boolean (value, toplevel->priv->anicafe); | |||
4217 | break; | |||
4218 | case PROP_ANIMATION_SPEED: | |||
4219 | g_value_set_enum (value, toplevel->priv->animation_speed); | |||
4220 | break; | |||
4221 | case PROP_BUTTONS_ENABLED: | |||
4222 | g_value_set_boolean (value, toplevel->priv->buttons_enabled); | |||
4223 | break; | |||
4224 | case PROP_ARROWS_ENABLED: | |||
4225 | g_value_set_boolean (value, toplevel->priv->arrows_enabled); | |||
4226 | break; | |||
4227 | default: | |||
4228 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec *_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id = ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'" , "panel-toplevel.c", 4228, ("property"), _glib__property_id, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance *) (_glib__pspec))->g_class))->g_type)))), (g_type_name ((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class ))->g_type)))))); } while (0); | |||
4229 | break; | |||
4230 | } | |||
4231 | } | |||
4232 | ||||
4233 | static GObject* | |||
4234 | panel_toplevel_constructor (GType type, | |||
4235 | guint n_construct_properties, | |||
4236 | GObjectConstructParam *construct_properties) | |||
4237 | { | |||
4238 | GObject *object; | |||
4239 | ||||
4240 | object = G_OBJECT_CLASS (panel_toplevel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), (((GType) ((20) << ( 2))))))))->constructor (type, | |||
4241 | n_construct_properties, | |||
4242 | construct_properties); | |||
4243 | PanelToplevel *toplevel = PANEL_TOPLEVEL(object)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((object)), ((panel_toplevel_get_type ())))))); | |||
4244 | CdkScreen *screen = ctk_widget_get_screen(CTK_WIDGET(toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
4245 | CdkVisual *visual = cdk_screen_get_rgba_visual(screen); | |||
4246 | ctk_widget_set_visual(CTK_WIDGET(toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), visual); | |||
4247 | ||||
4248 | return object; | |||
4249 | } | |||
4250 | ||||
4251 | static void | |||
4252 | panel_toplevel_finalize (GObject *object) | |||
4253 | { | |||
4254 | PanelToplevel *toplevel = (PanelToplevel *) object; | |||
4255 | ||||
4256 | #ifdef HAVE_X111 | |||
4257 | if (CDK_IS_X11_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)))(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (ctk_widget_get_display (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))))); GType __t = ((cdk_x11_display_get_type())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) | |||
4258 | panel_struts_unregister_strut (toplevel); | |||
4259 | #endif // HAVE_X11 | |||
4260 | ||||
4261 | toplevel_list = g_slist_remove (toplevel_list, toplevel); | |||
4262 | ||||
4263 | G_OBJECT_CLASS (panel_toplevel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((panel_toplevel_parent_class)), (((GType) ((20) << ( 2))))))))->finalize (object); | |||
4264 | } | |||
4265 | ||||
4266 | static void | |||
4267 | panel_toplevel_class_init (PanelToplevelClass *klass) | |||
4268 | { | |||
4269 | GObjectClass *gobject_class = (GObjectClass *) klass; | |||
4270 | CtkWidgetClass *widget_class = (CtkWidgetClass *) klass; | |||
4271 | CtkContainerClass *container_class = (CtkContainerClass *) klass; | |||
4272 | CtkBindingSet *binding_set; | |||
4273 | ||||
4274 | binding_set = ctk_binding_set_by_class (klass); | |||
4275 | ||||
4276 | gobject_class->constructor = panel_toplevel_constructor; | |||
4277 | gobject_class->set_property = panel_toplevel_set_property; | |||
4278 | gobject_class->get_property = panel_toplevel_get_property; | |||
4279 | gobject_class->finalize = panel_toplevel_finalize; | |||
4280 | ||||
4281 | gobject_class->dispose = panel_toplevel_dispose; | |||
4282 | ||||
4283 | widget_class->realize = panel_toplevel_realize; | |||
4284 | widget_class->unrealize = panel_toplevel_unrealize; | |||
4285 | widget_class->state_flags_changed = panel_toplevel_state_flags_changed; | |||
4286 | widget_class->draw = panel_toplevel_draw; | |||
4287 | widget_class->get_preferred_width = panel_toplevel_get_preferred_width; | |||
4288 | widget_class->get_preferred_height = panel_toplevel_get_preferred_height; | |||
4289 | widget_class->style_updated = panel_toplevel_style_updated; | |||
4290 | widget_class->size_allocate = panel_toplevel_size_allocate; | |||
4291 | widget_class->button_press_event = panel_toplevel_button_press_event; | |||
4292 | widget_class->button_release_event = panel_toplevel_button_release_event; | |||
4293 | widget_class->configure_event = panel_toplevel_configure_event; | |||
4294 | widget_class->key_press_event = panel_toplevel_key_press_event; | |||
4295 | widget_class->motion_notify_event = panel_toplevel_motion_notify_event; | |||
4296 | widget_class->enter_notify_event = panel_toplevel_enter_notify_event; | |||
4297 | widget_class->leave_notify_event = panel_toplevel_leave_notify_event; | |||
4298 | widget_class->screen_changed = panel_toplevel_screen_changed; | |||
4299 | widget_class->focus_in_event = panel_toplevel_focus_in_event; | |||
4300 | widget_class->focus_out_event = panel_toplevel_focus_out_event; | |||
4301 | ||||
4302 | ctk_widget_class_set_css_name (widget_class, "PanelToplevel"); | |||
4303 | ||||
4304 | container_class->check_resize = panel_toplevel_check_resize; | |||
4305 | ||||
4306 | klass->hiding = NULL((void*)0); | |||
4307 | klass->unhiding = NULL((void*)0); | |||
4308 | klass->popup_panel_menu = panel_toplevel_popup_panel_menu; | |||
4309 | klass->toggle_expand = panel_toplevel_toggle_expand; | |||
4310 | klass->expand = panel_toplevel_expand; | |||
4311 | klass->unexpand = panel_toplevel_unexpand; | |||
4312 | klass->toggle_hidden = panel_toplevel_toggle_hidden; | |||
4313 | klass->begin_move = panel_toplevel_begin_move; | |||
4314 | klass->begin_resize = panel_toplevel_begin_resize; | |||
4315 | ||||
4316 | g_object_class_install_property ( | |||
4317 | gobject_class, | |||
4318 | PROP_NAME, | |||
4319 | g_param_spec_string ( | |||
4320 | "name", | |||
4321 | "Name", | |||
4322 | "The name of this panel", | |||
4323 | NULL((void*)0), | |||
4324 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4325 | ||||
4326 | g_object_class_install_property ( | |||
4327 | gobject_class, | |||
4328 | PROP_SETTINGS_PATH, | |||
4329 | g_param_spec_string ( | |||
4330 | "settings-path", | |||
4331 | "GSettings path", | |||
4332 | "The GSettings path used for this panel", | |||
4333 | NULL((void*)0), | |||
4334 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4335 | ||||
4336 | g_object_class_install_property ( | |||
4337 | gobject_class, | |||
4338 | PROP_EXPAND, | |||
4339 | g_param_spec_boolean ( | |||
4340 | "expand", | |||
4341 | "Expand", | |||
4342 | "Expand to take up the full monitor width/height", | |||
4343 | TRUE(!(0)), | |||
4344 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4345 | ||||
4346 | g_object_class_install_property ( | |||
4347 | gobject_class, | |||
4348 | PROP_ORIENTATION, | |||
4349 | g_param_spec_enum ( | |||
4350 | "orientation", | |||
4351 | "Orientation", | |||
4352 | "The orientation of the panel", | |||
4353 | PANEL_TYPE_ORIENTATIONpanel_orientation_get_type(), | |||
4354 | PANEL_ORIENTATION_TOP, | |||
4355 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4356 | ||||
4357 | g_object_class_install_property ( | |||
4358 | gobject_class, | |||
4359 | PROP_SIZE, | |||
4360 | g_param_spec_int ( | |||
4361 | "size", | |||
4362 | "Size", | |||
4363 | "The height (or width when vertical) of the panel", | |||
4364 | 0, | |||
4365 | G_MAXINT2147483647, | |||
4366 | DEFAULT_SIZE48, | |||
4367 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4368 | ||||
4369 | ||||
4370 | g_object_class_install_property ( | |||
4371 | gobject_class, | |||
4372 | PROP_X, | |||
4373 | g_param_spec_int ( | |||
4374 | "x", | |||
4375 | "X position", | |||
4376 | "The X position of the panel", | |||
4377 | 0, | |||
4378 | G_MAXINT2147483647, | |||
4379 | 0, | |||
4380 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4381 | ||||
4382 | g_object_class_install_property ( | |||
4383 | gobject_class, | |||
4384 | PROP_X_RIGHT, | |||
4385 | g_param_spec_int ( | |||
4386 | "x-right", | |||
4387 | "X position, from the right", | |||
4388 | "The X position of the panel, starting from the right of the screen", | |||
4389 | -1, | |||
4390 | G_MAXINT2147483647, | |||
4391 | -1, | |||
4392 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4393 | ||||
4394 | g_object_class_install_property ( | |||
4395 | gobject_class, | |||
4396 | PROP_X_CENTERED, | |||
4397 | g_param_spec_boolean ( | |||
4398 | "x-centered", | |||
4399 | "X centered", | |||
4400 | "The x co-ordinate is relative to center screen", | |||
4401 | FALSE(0), | |||
4402 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4403 | ||||
4404 | g_object_class_install_property ( | |||
4405 | gobject_class, | |||
4406 | PROP_Y, | |||
4407 | g_param_spec_int ( | |||
4408 | "y", | |||
4409 | "Y position", | |||
4410 | "The Y position of the panel", | |||
4411 | 0, | |||
4412 | G_MAXINT2147483647, | |||
4413 | 0, | |||
4414 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4415 | ||||
4416 | g_object_class_install_property ( | |||
4417 | gobject_class, | |||
4418 | PROP_Y_BOTTOM, | |||
4419 | g_param_spec_int ( | |||
4420 | "y_bottom", | |||
4421 | "Y position, from the bottom", | |||
4422 | "The Y position of the panel, starting from the bottom of the screen", | |||
4423 | -1, | |||
4424 | G_MAXINT2147483647, | |||
4425 | -1, | |||
4426 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4427 | ||||
4428 | g_object_class_install_property ( | |||
4429 | gobject_class, | |||
4430 | PROP_Y_CENTERED, | |||
4431 | g_param_spec_boolean ( | |||
4432 | "y-centered", | |||
4433 | "Y centered", | |||
4434 | "The y co-ordinate is relative to center screen", | |||
4435 | FALSE(0), | |||
4436 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4437 | ||||
4438 | g_object_class_install_property ( | |||
4439 | gobject_class, | |||
4440 | PROP_MONITOR, | |||
4441 | g_param_spec_int ( | |||
4442 | "monitor", | |||
4443 | "Xinerama monitor", | |||
4444 | "The monitor (in terms of Xinerama) which the panel is on", | |||
4445 | 0, | |||
4446 | G_MAXINT2147483647, | |||
4447 | 0, | |||
4448 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4449 | ||||
4450 | g_object_class_install_property ( | |||
4451 | gobject_class, | |||
4452 | PROP_AUTOHIDE, | |||
4453 | g_param_spec_boolean ( | |||
4454 | "auto-hide", | |||
4455 | "Auto hide", | |||
4456 | "Automatically hide the panel when the mouse leaves the panel", | |||
4457 | FALSE(0), | |||
4458 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4459 | ||||
4460 | g_object_class_install_property ( | |||
4461 | gobject_class, | |||
4462 | PROP_HIDE_DELAY, | |||
4463 | g_param_spec_int ( | |||
4464 | "hide-delay", | |||
4465 | "Hide delay", | |||
4466 | "The number of milliseconds to delay before automatically hiding", | |||
4467 | 0, | |||
4468 | G_MAXINT2147483647, | |||
4469 | DEFAULT_HIDE_DELAY300, | |||
4470 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4471 | ||||
4472 | g_object_class_install_property ( | |||
4473 | gobject_class, | |||
4474 | PROP_UNHIDE_DELAY, | |||
4475 | g_param_spec_int ( | |||
4476 | "unhide-delay", | |||
4477 | "Un-hide delay", | |||
4478 | "The number of milliseconds to delay before automatically un-hiding", | |||
4479 | 0, | |||
4480 | G_MAXINT2147483647, | |||
4481 | DEFAULT_UNHIDE_DELAY100, | |||
4482 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4483 | ||||
4484 | g_object_class_install_property ( | |||
4485 | gobject_class, | |||
4486 | PROP_AUTOHIDE_SIZE, | |||
4487 | g_param_spec_int ( | |||
4488 | "auto-hide-size", | |||
4489 | "Auto-hide size", | |||
4490 | "The number of pixels visible when the panel has been automatically hidden", | |||
4491 | 1, | |||
4492 | G_MAXINT2147483647, | |||
4493 | DEFAULT_AUTO_HIDE_SIZE1, | |||
4494 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4495 | ||||
4496 | g_object_class_install_property ( | |||
4497 | gobject_class, | |||
4498 | PROP_ANICAFE, | |||
4499 | g_param_spec_boolean ( | |||
4500 | "anicafe", | |||
4501 | "Anicafe", | |||
4502 | "Enable hiding/showing animations", | |||
4503 | TRUE(!(0)), | |||
4504 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4505 | ||||
4506 | g_object_class_install_property ( | |||
4507 | gobject_class, | |||
4508 | PROP_ANIMATION_SPEED, | |||
4509 | g_param_spec_enum ( | |||
4510 | "animation-speed", | |||
4511 | "Animation Speed", | |||
4512 | "The speed at which to anicafe panel hiding/showing", | |||
4513 | PANEL_TYPE_ANIMATION_SPEEDpanel_animation_speed_get_type(), | |||
4514 | PANEL_ANIMATION_MEDIUM, | |||
4515 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4516 | ||||
4517 | g_object_class_install_property ( | |||
4518 | gobject_class, | |||
4519 | PROP_BUTTONS_ENABLED, | |||
4520 | g_param_spec_boolean ( | |||
4521 | "buttons-enabled", | |||
4522 | "Buttons Enabled", | |||
4523 | "Enable hide/show buttons", | |||
4524 | TRUE(!(0)), | |||
4525 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4526 | ||||
4527 | g_object_class_install_property ( | |||
4528 | gobject_class, | |||
4529 | PROP_ARROWS_ENABLED, | |||
4530 | g_param_spec_boolean ( | |||
4531 | "arrows-enabled", | |||
4532 | "Arrows Enabled", | |||
4533 | "Enable arrows on hide/show buttons", | |||
4534 | TRUE(!(0)), | |||
4535 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | |||
4536 | ||||
4537 | ctk_widget_class_install_style_property ( | |||
4538 | widget_class, | |||
4539 | g_param_spec_int ( | |||
4540 | "arrow-size", | |||
4541 | "Arrow Size", | |||
4542 | "The size of the arrows on the hide/show buttons", | |||
4543 | 0, | |||
4544 | G_MAXINT2147483647, | |||
4545 | DEFAULT_ARROW_SIZE20, | |||
4546 | G_PARAM_READABLE)); | |||
4547 | ||||
4548 | toplevel_signals [HIDE_SIGNAL] = | |||
4549 | g_signal_new ("hiding", | |||
4550 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4551 | G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |||
4552 | G_STRUCT_OFFSET (PanelToplevelClass, hiding)((glong) __builtin_offsetof(PanelToplevelClass, hiding)), | |||
4553 | NULL((void*)0), | |||
4554 | NULL((void*)0), | |||
4555 | g_cclosure_marshal_VOID__VOID, | |||
4556 | G_TYPE_NONE((GType) ((1) << (2))), | |||
4557 | 0); | |||
4558 | ||||
4559 | toplevel_signals [UNHIDE_SIGNAL] = | |||
4560 | g_signal_new ("unhiding", | |||
4561 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4562 | G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, | |||
4563 | G_STRUCT_OFFSET (PanelToplevelClass, unhiding)((glong) __builtin_offsetof(PanelToplevelClass, unhiding)), | |||
4564 | NULL((void*)0), | |||
4565 | NULL((void*)0), | |||
4566 | g_cclosure_marshal_VOID__VOID, | |||
4567 | G_TYPE_NONE((GType) ((1) << (2))), | |||
4568 | 0); | |||
4569 | ||||
4570 | toplevel_signals [POPUP_PANEL_MENU_SIGNAL] = | |||
4571 | g_signal_new ("popup-panel-menu", | |||
4572 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4573 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4574 | G_STRUCT_OFFSET (PanelToplevelClass, popup_panel_menu)((glong) __builtin_offsetof(PanelToplevelClass, popup_panel_menu )), | |||
4575 | NULL((void*)0), | |||
4576 | NULL((void*)0), | |||
4577 | panel_marshal_BOOLEAN__VOID, | |||
4578 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4579 | 0); | |||
4580 | ||||
4581 | toplevel_signals [TOGGLE_EXPAND_SIGNAL] = | |||
4582 | g_signal_new ("toggle-expand", | |||
4583 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4584 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4585 | G_STRUCT_OFFSET (PanelToplevelClass, toggle_expand)((glong) __builtin_offsetof(PanelToplevelClass, toggle_expand )), | |||
4586 | NULL((void*)0), | |||
4587 | NULL((void*)0), | |||
4588 | panel_marshal_BOOLEAN__VOID, | |||
4589 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4590 | 0); | |||
4591 | ||||
4592 | toplevel_signals [EXPAND_SIGNAL] = | |||
4593 | g_signal_new ("expand", | |||
4594 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4595 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4596 | G_STRUCT_OFFSET (PanelToplevelClass, expand)((glong) __builtin_offsetof(PanelToplevelClass, expand)), | |||
4597 | NULL((void*)0), | |||
4598 | NULL((void*)0), | |||
4599 | panel_marshal_BOOLEAN__VOID, | |||
4600 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4601 | 0); | |||
4602 | ||||
4603 | toplevel_signals [UNEXPAND_SIGNAL] = | |||
4604 | g_signal_new ("unexpand", | |||
4605 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4606 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4607 | G_STRUCT_OFFSET (PanelToplevelClass, unexpand)((glong) __builtin_offsetof(PanelToplevelClass, unexpand)), | |||
4608 | NULL((void*)0), | |||
4609 | NULL((void*)0), | |||
4610 | panel_marshal_BOOLEAN__VOID, | |||
4611 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4612 | 0); | |||
4613 | ||||
4614 | toplevel_signals [TOGGLE_HIDDEN_SIGNAL] = | |||
4615 | g_signal_new ("toggle-hidden", | |||
4616 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4617 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4618 | G_STRUCT_OFFSET (PanelToplevelClass, toggle_hidden)((glong) __builtin_offsetof(PanelToplevelClass, toggle_hidden )), | |||
4619 | NULL((void*)0), | |||
4620 | NULL((void*)0), | |||
4621 | panel_marshal_BOOLEAN__VOID, | |||
4622 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4623 | 0); | |||
4624 | ||||
4625 | toplevel_signals [BEGIN_MOVE_SIGNAL] = | |||
4626 | g_signal_new ("begin-move", | |||
4627 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4628 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4629 | G_STRUCT_OFFSET (PanelToplevelClass, begin_move)((glong) __builtin_offsetof(PanelToplevelClass, begin_move)), | |||
4630 | NULL((void*)0), | |||
4631 | NULL((void*)0), | |||
4632 | panel_marshal_BOOLEAN__VOID, | |||
4633 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4634 | 0); | |||
4635 | ||||
4636 | toplevel_signals [BEGIN_RESIZE_SIGNAL] = | |||
4637 | g_signal_new ("begin-resize", | |||
4638 | G_TYPE_FROM_CLASS (gobject_class)(((GTypeClass*) (gobject_class))->g_type), | |||
4639 | G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, | |||
4640 | G_STRUCT_OFFSET (PanelToplevelClass, begin_resize)((glong) __builtin_offsetof(PanelToplevelClass, begin_resize) ), | |||
4641 | NULL((void*)0), | |||
4642 | NULL((void*)0), | |||
4643 | panel_marshal_BOOLEAN__VOID, | |||
4644 | G_TYPE_BOOLEAN((GType) ((5) << (2))), | |||
4645 | 0); | |||
4646 | ||||
4647 | ctk_binding_entry_add_signal (binding_set, CDK_KEY_F100xffc7, CDK_CONTROL_MASK, | |||
4648 | "popup_panel_menu", 0); | |||
4649 | ||||
4650 | panel_bindings_set_entries (binding_set); | |||
4651 | } | |||
4652 | ||||
4653 | static void | |||
4654 | panel_toplevel_setup_widgets (PanelToplevel *toplevel) | |||
4655 | { | |||
4656 | CtkWidget* container; | |||
4657 | ||||
4658 | toplevel->priv->grid = ctk_grid_new (); | |||
4659 | ||||
4660 | toplevel->priv->hide_button_top = panel_toplevel_add_hide_button (toplevel, CTK_ARROW_UP, 1, 0); | |||
4661 | toplevel->priv->hide_button_bottom = panel_toplevel_add_hide_button (toplevel, CTK_ARROW_DOWN, 1, 2); | |||
4662 | toplevel->priv->hide_button_left = panel_toplevel_add_hide_button (toplevel, CTK_ARROW_LEFT, 0, 1); | |||
4663 | toplevel->priv->hide_button_right = panel_toplevel_add_hide_button (toplevel, CTK_ARROW_RIGHT, 2, 1); | |||
4664 | ||||
4665 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
4666 | { | |||
4667 | ctk_widget_show(toplevel->priv->hide_button_left); | |||
4668 | ctk_widget_show(toplevel->priv->hide_button_right); | |||
4669 | } | |||
4670 | else | |||
4671 | { | |||
4672 | ctk_widget_show(toplevel->priv->hide_button_top); | |||
4673 | ctk_widget_show(toplevel->priv->hide_button_bottom); | |||
4674 | } | |||
4675 | ||||
4676 | toplevel->priv->inner_frame = g_object_new(PANEL_TYPE_FRAME(panel_frame_get_type ()), NULL((void*)0)); | |||
4677 | ||||
4678 | ctk_widget_set_hexpand (CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ())))))), TRUE(!(0))); | |||
4679 | ctk_widget_set_vexpand (CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ())))))), TRUE(!(0))); | |||
4680 | ||||
4681 | ctk_grid_attach (CTK_GRID (toplevel->priv->grid)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->grid)), ((ctk_grid_get_type ())))) )), CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ())))))), 1, 1, 1, 1); | |||
4682 | ctk_widget_show (CTK_WIDGET (toplevel->priv->inner_frame)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_widget_get_type ()))))))); | |||
4683 | ||||
4684 | container = panel_widget_new (toplevel, | |||
4685 | !toplevel->priv->expand, | |||
4686 | (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) ? | |||
4687 | CTK_ORIENTATION_HORIZONTAL : | |||
4688 | CTK_ORIENTATION_VERTICAL, | |||
4689 | toplevel->priv->size); | |||
4690 | ||||
4691 | toplevel->priv->panel_widget = PANEL_WIDGET(container)((((PanelWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((container)), ((panel_widget_get_type())))))); | |||
4692 | ||||
4693 | ctk_container_add(CTK_CONTAINER(toplevel->priv->inner_frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel->priv->inner_frame)), ((ctk_container_get_type ())))))), container); | |||
4694 | ctk_widget_show(container); | |||
4695 | ||||
4696 | ctk_container_add (CTK_CONTAINER (toplevel)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_container_get_type ())))))), toplevel->priv->grid); | |||
4697 | ctk_widget_show (toplevel->priv->grid); | |||
4698 | } | |||
4699 | ||||
4700 | static void | |||
4701 | background_changed (PanelBackground *background, | |||
4702 | PanelToplevel *toplevel) | |||
4703 | { | |||
4704 | panel_toplevel_update_edges (toplevel); | |||
4705 | panel_widget_emit_background_changed (toplevel->priv->panel_widget); | |||
4706 | } | |||
4707 | ||||
4708 | static void | |||
4709 | panel_toplevel_init (PanelToplevel *toplevel) | |||
4710 | { | |||
4711 | CtkWidget *widget; | |||
4712 | int i; | |||
4713 | ||||
4714 | toplevel->priv = panel_toplevel_get_instance_private (toplevel); | |||
4715 | ||||
4716 | toplevel->priv->expand = TRUE(!(0)); | |||
4717 | toplevel->priv->orientation = PANEL_ORIENTATION_BOTTOM; | |||
4718 | toplevel->priv->size = DEFAULT_SIZE48; | |||
4719 | toplevel->priv->scale = ctk_widget_get_scale_factor (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
4720 | toplevel->priv->x = 0; | |||
4721 | toplevel->priv->y = 0; | |||
4722 | toplevel->priv->x_right = -1; | |||
4723 | toplevel->priv->y_bottom = -1; | |||
4724 | toplevel->priv->monitor = 0; | |||
4725 | toplevel->priv->configured_monitor = -1; | |||
4726 | toplevel->priv->hide_delay = DEFAULT_HIDE_DELAY300; | |||
4727 | toplevel->priv->unhide_delay = DEFAULT_UNHIDE_DELAY100; | |||
4728 | toplevel->priv->auto_hide_size = DEFAULT_AUTO_HIDE_SIZE1; | |||
4729 | toplevel->priv->animation_speed = PANEL_ANIMATION_FAST; | |||
4730 | ||||
4731 | toplevel->priv->snap_tolerance = DEFAULT_DND_THRESHOLD8 * SNAP_TOLERANCE_FACTOR6; | |||
4732 | toplevel->priv->ctk_settings = NULL((void*)0); | |||
4733 | ||||
4734 | toplevel->priv->state = PANEL_STATE_NORMAL; | |||
4735 | ||||
4736 | toplevel->priv->name = NULL((void*)0); | |||
4737 | toplevel->priv->description = NULL((void*)0); | |||
4738 | ||||
4739 | toplevel->priv->hide_timeout = 0; | |||
4740 | toplevel->priv->unhide_timeout = 0; | |||
4741 | ||||
4742 | toplevel->priv->geometry.x = -1; | |||
4743 | toplevel->priv->geometry.y = -1; | |||
4744 | toplevel->priv->geometry.width = -1; | |||
4745 | toplevel->priv->geometry.height = -1; | |||
4746 | ||||
4747 | toplevel->priv->original_width = -1; | |||
4748 | toplevel->priv->original_height = -1; | |||
4749 | ||||
4750 | toplevel->priv->grab_op = PANEL_GRAB_OP_NONE; | |||
4751 | ||||
4752 | toplevel->priv->drag_offset_x = 0; | |||
4753 | toplevel->priv->drag_offset_y = 0; | |||
4754 | ||||
4755 | toplevel->priv->animation_end_x = 0; | |||
4756 | toplevel->priv->animation_end_y = 0; | |||
4757 | toplevel->priv->animation_end_width = 0; | |||
4758 | toplevel->priv->animation_end_height = 0; | |||
4759 | toplevel->priv->animation_start_time.tv_sec = 0; | |||
4760 | toplevel->priv->animation_start_time.tv_usec = 0; | |||
4761 | toplevel->priv->animation_end_time.tv_sec = 0; | |||
4762 | toplevel->priv->animation_end_time.tv_usec = 0; | |||
4763 | toplevel->priv->animation_timeout = 0; | |||
4764 | ||||
4765 | toplevel->priv->panel_widget = NULL((void*)0); | |||
4766 | toplevel->priv->inner_frame = NULL((void*)0); | |||
4767 | toplevel->priv->grid = NULL((void*)0); | |||
4768 | toplevel->priv->hide_button_top = NULL((void*)0); | |||
4769 | toplevel->priv->hide_button_bottom = NULL((void*)0); | |||
4770 | toplevel->priv->hide_button_left = NULL((void*)0); | |||
4771 | toplevel->priv->hide_button_right = NULL((void*)0); | |||
4772 | ||||
4773 | toplevel->priv->attach_toplevel = NULL((void*)0); | |||
4774 | toplevel->priv->attach_widget = NULL((void*)0); | |||
4775 | toplevel->priv->n_autohide_disablers = 0; | |||
4776 | ||||
4777 | for (i = 0; i < N_ATTACH_TOPLEVEL_SIGNALS5; i++) | |||
4778 | toplevel->priv->attach_toplevel_signals [i] = 0; | |||
4779 | for (i = 0; i < N_ATTACH_WIDGET_SIGNALS5; i++) | |||
4780 | toplevel->priv->attach_widget_signals [i] = 0; | |||
4781 | ||||
4782 | toplevel->priv->auto_hide = FALSE(0); | |||
4783 | toplevel->priv->buttons_enabled = TRUE(!(0)); | |||
4784 | toplevel->priv->arrows_enabled = TRUE(!(0)); | |||
4785 | toplevel->priv->x_centered = FALSE(0); | |||
4786 | toplevel->priv->y_centered = FALSE(0); | |||
4787 | toplevel->priv->animating = FALSE(0); | |||
4788 | toplevel->priv->grab_is_keyboard = FALSE(0); | |||
4789 | toplevel->priv->position_centered = FALSE(0); | |||
4790 | toplevel->priv->attached = FALSE(0); | |||
4791 | toplevel->priv->attach_hidden = FALSE(0); | |||
4792 | toplevel->priv->updated_geometry_initial = FALSE(0); | |||
4793 | toplevel->priv->initial_animation_done = FALSE(0); | |||
4794 | ||||
4795 | widget = CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))); | |||
4796 | ctk_widget_add_events (widget, | |||
4797 | CDK_BUTTON_PRESS_MASK | | |||
4798 | CDK_BUTTON_RELEASE_MASK | | |||
4799 | CDK_POINTER_MOTION_MASK | | |||
4800 | CDK_ENTER_NOTIFY_MASK | | |||
4801 | CDK_LEAVE_NOTIFY_MASK); | |||
4802 | ||||
4803 | ctk_widget_set_app_paintable (widget, TRUE(!(0))); | |||
4804 | ||||
4805 | panel_toplevel_setup_widgets (toplevel); | |||
4806 | panel_toplevel_update_description (toplevel); | |||
4807 | panel_toplevel_update_ctk_settings (toplevel); | |||
4808 | ||||
4809 | toplevel_list = g_slist_prepend (toplevel_list, toplevel); | |||
4810 | ||||
4811 | /* Prevent the window from being deleted via Alt+F4 by accident. This | |||
4812 | * happens with "alternative" window managers such as Sawfish or XFWM4. | |||
4813 | */ | |||
4814 | g_signal_connect(CTK_WIDGET(toplevel), "delete-event", G_CALLBACK(ctk_true), NULL)g_signal_connect_data ((((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((toplevel)), ((ctk_widget_get_type ())))) ))), ("delete-event"), (((GCallback) (ctk_true))), (((void*)0 )), ((void*)0), (GConnectFlags) 0); | |||
4815 | ||||
4816 | panel_background_init (&toplevel->background, | |||
4817 | (PanelBackgroundChangedNotify) background_changed, | |||
4818 | toplevel); | |||
4819 | ||||
4820 | update_style_classes (toplevel); | |||
4821 | ||||
4822 | #ifdef HAVE_WAYLAND | |||
4823 | if (CDK_IS_WAYLAND_DISPLAY (cdk_display_get_default ())) { | |||
4824 | wayland_panel_toplevel_init (toplevel); | |||
4825 | } | |||
4826 | #endif // HAVE_WAYLAND | |||
4827 | } | |||
4828 | ||||
4829 | PanelWidget * | |||
4830 | panel_toplevel_get_panel_widget (PanelToplevel *toplevel) | |||
4831 | { | |||
4832 | ||||
4833 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (((void *)0)); } } while (0); | |||
4834 | ||||
4835 | return toplevel->priv->panel_widget; | |||
4836 | } | |||
4837 | ||||
4838 | static void | |||
4839 | panel_toplevel_update_name (PanelToplevel *toplevel) | |||
4840 | { | |||
4841 | char *title; | |||
4842 | ||||
4843 | g_assert (toplevel->priv->description != NULL)do { if (toplevel->priv->description != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c", 4843 , ((const char*) (__func__)), "toplevel->priv->description != NULL" ); } while (0); | |||
4844 | ||||
4845 | title = toplevel->priv->name ? toplevel->priv->name : toplevel->priv->description; | |||
4846 | ||||
4847 | ctk_window_set_title (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))), title); | |||
4848 | ||||
4849 | panel_a11y_set_atk_name_desc ( | |||
4850 | CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), | |||
4851 | title, toplevel->priv->description); | |||
4852 | } | |||
4853 | ||||
4854 | void | |||
4855 | panel_toplevel_set_name (PanelToplevel *toplevel, | |||
4856 | const char *name) | |||
4857 | { | |||
4858 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
4859 | ||||
4860 | if (!toplevel->priv->name && (!name || !name [0])) | |||
4861 | return; | |||
4862 | ||||
4863 | if (toplevel->priv->name && name && name [0] && | |||
4864 | !strcmp (toplevel->priv->name, name)) | |||
4865 | return; | |||
4866 | ||||
4867 | if (toplevel->priv->name) | |||
4868 | g_free (toplevel->priv->name); | |||
4869 | toplevel->priv->name = NULL((void*)0); | |||
4870 | ||||
4871 | if (name && name [0]) | |||
4872 | toplevel->priv->name = g_strdup (name)g_strdup_inline (name); | |||
4873 | ||||
4874 | panel_toplevel_update_name (toplevel); | |||
4875 | ||||
4876 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "name"); | |||
4877 | } | |||
4878 | ||||
4879 | void | |||
4880 | panel_toplevel_set_settings_path (PanelToplevel *toplevel, | |||
4881 | const char *settings_path) | |||
4882 | { | |||
4883 | toplevel->priv->settings_path = g_strdup (settings_path)g_strdup_inline (settings_path); | |||
4884 | } | |||
4885 | ||||
4886 | const char* panel_toplevel_get_name(PanelToplevel* toplevel) | |||
4887 | { | |||
4888 | g_return_val_if_fail(PANEL_IS_TOPLEVEL(toplevel), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL(toplevel)"); return (((void *)0)); } } while (0); | |||
4889 | ||||
4890 | return toplevel->priv->name; | |||
4891 | } | |||
4892 | ||||
4893 | const char* panel_toplevel_get_description(PanelToplevel* toplevel) | |||
4894 | { | |||
4895 | g_return_val_if_fail(PANEL_IS_TOPLEVEL(toplevel), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL(toplevel)"); return (((void *)0)); } } while (0); | |||
4896 | ||||
4897 | return toplevel->priv->description; | |||
4898 | } | |||
4899 | ||||
4900 | void | |||
4901 | panel_toplevel_set_expand (PanelToplevel *toplevel, | |||
4902 | gboolean expand) | |||
4903 | { | |||
4904 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
4905 | ||||
4906 | if (toplevel->priv->attached && expand) { | |||
4907 | g_warning ("attempt to expand attached toplevel; ignoring"); | |||
4908 | return; | |||
4909 | } | |||
4910 | ||||
4911 | expand = expand != FALSE(0); | |||
4912 | ||||
4913 | if (toplevel->priv->expand == expand) | |||
4914 | return; | |||
4915 | ||||
4916 | toplevel->priv->expand = expand; | |||
4917 | ||||
4918 | if (!toplevel->priv->expand && toplevel->priv->updated_geometry_initial) { | |||
4919 | switch (toplevel->priv->orientation) { | |||
4920 | case PANEL_ORIENTATION_TOP: | |||
4921 | panel_toplevel_set_x (toplevel, 0, -1, TRUE(!(0))); | |||
4922 | break; | |||
4923 | case PANEL_ORIENTATION_BOTTOM: | |||
4924 | panel_toplevel_set_x (toplevel, 0, 0, TRUE(!(0))); | |||
4925 | break; | |||
4926 | case PANEL_ORIENTATION_LEFT: | |||
4927 | panel_toplevel_set_y (toplevel, 0, -1, TRUE(!(0))); | |||
4928 | break; | |||
4929 | case PANEL_ORIENTATION_RIGHT: | |||
4930 | panel_toplevel_set_y (toplevel, 0, 0, TRUE(!(0))); | |||
4931 | break; | |||
4932 | default: | |||
4933 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-toplevel.c" , 4933, ((const char*) (__func__)), ((void*)0)); } while (0); | |||
4934 | break; | |||
4935 | } | |||
4936 | } | |||
4937 | ||||
4938 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
4939 | ||||
4940 | panel_widget_set_packed (toplevel->priv->panel_widget, !toplevel->priv->expand); | |||
4941 | ||||
4942 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "expand"); | |||
4943 | } | |||
4944 | ||||
4945 | gboolean | |||
4946 | panel_toplevel_get_expand (PanelToplevel *toplevel) | |||
4947 | { | |||
4948 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), TRUE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((!(0) )); } } while (0); | |||
4949 | ||||
4950 | return toplevel->priv->expand; | |||
4951 | } | |||
4952 | ||||
4953 | gboolean | |||
4954 | panel_toplevel_get_is_floating (PanelToplevel *toplevel) | |||
4955 | { | |||
4956 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), TRUE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((!(0) )); } } while (0); | |||
4957 | ||||
4958 | return toplevel->priv->floating; | |||
4959 | } | |||
4960 | ||||
4961 | void | |||
4962 | panel_toplevel_set_orientation (PanelToplevel *toplevel, | |||
4963 | PanelOrientation orientation) | |||
4964 | { | |||
4965 | gboolean rotate; | |||
4966 | CdkRectangle monitor_geom; | |||
4967 | ||||
4968 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
4969 | ||||
4970 | if (toplevel->priv->orientation == orientation) | |||
4971 | return; | |||
4972 | ||||
4973 | g_object_freeze_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
4974 | ||||
4975 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
4976 | ||||
4977 | /* Un-snap from center if no longer along screen edge */ | |||
4978 | if (toplevel->priv->x_centered && | |||
4979 | (orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) { | |||
4980 | toplevel->priv->x_centered = FALSE(0); | |||
4981 | toplevel->priv->x = (monitor_geom.width - toplevel->priv->geometry.width) / 2; | |||
4982 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x"); | |||
4983 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x-centered"); | |||
4984 | ||||
4985 | if (toplevel->priv->x_right != -1) { | |||
4986 | toplevel->priv->x_right = -1; | |||
4987 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x-right"); | |||
4988 | } | |||
4989 | } | |||
4990 | ||||
4991 | if (toplevel->priv->y_centered && | |||
4992 | (orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) { | |||
4993 | toplevel->priv->y_centered = FALSE(0); | |||
4994 | toplevel->priv->y = (monitor_geom.height - toplevel->priv->geometry.height) / 2; | |||
4995 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y"); | |||
4996 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y-centered"); | |||
4997 | ||||
4998 | if (toplevel->priv->y_bottom != -1) { | |||
4999 | toplevel->priv->y_bottom = -1; | |||
5000 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y-bottom"); | |||
5001 | } | |||
5002 | } | |||
5003 | ||||
5004 | rotate = FALSE(0); | |||
5005 | if ((orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) && | |||
5006 | (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT))) | |||
5007 | rotate = TRUE(!(0)); | |||
5008 | else if ((orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) && | |||
5009 | (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM))) | |||
5010 | rotate = TRUE(!(0)); | |||
5011 | ||||
5012 | /* rotate around the center */ | |||
5013 | if (rotate && !toplevel->priv->position_centered && !toplevel->priv->expand && | |||
5014 | toplevel->priv->updated_geometry_initial) { | |||
5015 | toplevel->priv->position_centered = TRUE(!(0)); | |||
5016 | ||||
5017 | /* x, y temporary refer to the panel center, so we don't care | |||
5018 | * about x_right, y_bottom. Those will get updated in | |||
5019 | * panel_toplevel_update_position() accordingly. */ | |||
5020 | if (!toplevel->priv->x_centered) { | |||
5021 | toplevel->priv->x += toplevel->priv->geometry.width / 2; | |||
5022 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x"); | |||
5023 | } | |||
5024 | ||||
5025 | if (!toplevel->priv->y_centered) { | |||
5026 | toplevel->priv->y += toplevel->priv->geometry.height / 2; | |||
5027 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y"); | |||
5028 | } | |||
5029 | ||||
5030 | } | |||
5031 | ||||
5032 | toplevel->priv->orientation = orientation; | |||
5033 | update_style_classes (toplevel); | |||
5034 | ||||
5035 | ctk_widget_reset_style (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5036 | ||||
5037 | panel_toplevel_update_hide_buttons (toplevel); | |||
5038 | ||||
5039 | panel_widget_set_orientation ( | |||
5040 | toplevel->priv->panel_widget, | |||
5041 | (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) ? | |||
5042 | CTK_ORIENTATION_HORIZONTAL : | |||
5043 | CTK_ORIENTATION_VERTICAL); | |||
5044 | ||||
5045 | switch (toplevel->priv->state) { | |||
5046 | case PANEL_STATE_HIDDEN_UP: | |||
5047 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
5048 | toplevel->priv->state = PANEL_STATE_HIDDEN_LEFT; | |||
5049 | break; | |||
5050 | case PANEL_STATE_HIDDEN_DOWN: | |||
5051 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
5052 | toplevel->priv->state = PANEL_STATE_HIDDEN_RIGHT; | |||
5053 | break; | |||
5054 | case PANEL_STATE_HIDDEN_LEFT: | |||
5055 | if (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
5056 | toplevel->priv->state = PANEL_STATE_HIDDEN_UP; | |||
5057 | break; | |||
5058 | case PANEL_STATE_HIDDEN_RIGHT: | |||
5059 | if (toplevel->priv->orientation & PANEL_VERTICAL_MASK(PANEL_ORIENTATION_LEFT | PANEL_ORIENTATION_RIGHT)) | |||
5060 | toplevel->priv->state = PANEL_STATE_HIDDEN_DOWN; | |||
5061 | break; | |||
5062 | default: | |||
5063 | break; | |||
5064 | } | |||
5065 | ||||
5066 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5067 | ||||
5068 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "orientation"); | |||
5069 | ||||
5070 | g_object_thaw_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
5071 | ||||
5072 | #ifdef HAVE_WAYLAND | |||
5073 | if (CDK_IS_WAYLAND_DISPLAY (ctk_widget_get_display (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))))) { | |||
5074 | wayland_panel_toplevel_update_placement (toplevel); | |||
5075 | } | |||
5076 | #endif // HAVE_WAYLAND | |||
5077 | } | |||
5078 | ||||
5079 | PanelOrientation | |||
5080 | panel_toplevel_get_orientation (PanelToplevel *toplevel) | |||
5081 | { | |||
5082 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), CTK_ORIENTATION_HORIZONTAL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (CTK_ORIENTATION_HORIZONTAL ); } } while (0); | |||
5083 | ||||
5084 | return toplevel->priv->orientation; | |||
5085 | } | |||
5086 | ||||
5087 | void | |||
5088 | panel_toplevel_set_size (PanelToplevel *toplevel, | |||
5089 | int size) | |||
5090 | { | |||
5091 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5092 | g_return_if_fail (size >= 0)do { if ((size >= 0)) { } else { g_return_if_fail_warning ( ((gchar*) 0), ((const char*) (__func__)), "size >= 0"); return ; } } while (0); | |||
5093 | ||||
5094 | if (toplevel->priv->size == size) | |||
5095 | return; | |||
5096 | ||||
5097 | toplevel->priv->size = size; | |||
5098 | ||||
5099 | panel_widget_set_size (toplevel->priv->panel_widget, toplevel->priv->size); | |||
5100 | ||||
5101 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5102 | ||||
5103 | panel_toplevel_update_hide_buttons (toplevel); | |||
5104 | ||||
5105 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "size"); | |||
5106 | } | |||
5107 | ||||
5108 | int | |||
5109 | panel_toplevel_get_size (PanelToplevel *toplevel) | |||
5110 | { | |||
5111 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), DEFAULT_SIZE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (48); } } while (0); | |||
5112 | ||||
5113 | return toplevel->priv->size; | |||
5114 | } | |||
5115 | ||||
5116 | void | |||
5117 | panel_toplevel_set_auto_hide_size (PanelToplevel *toplevel, | |||
5118 | int auto_hide_size) | |||
5119 | { | |||
5120 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5121 | ||||
5122 | if (toplevel->priv->auto_hide_size == auto_hide_size) | |||
5123 | return; | |||
5124 | ||||
5125 | toplevel->priv->auto_hide_size = auto_hide_size; | |||
5126 | ||||
5127 | if (toplevel->priv->state == PANEL_STATE_AUTO_HIDDEN) { | |||
5128 | if (panel_toplevel_update_struts (toplevel, FALSE(0))) { | |||
5129 | if (toplevel->priv->anicafe) { | |||
5130 | panel_toplevel_unhide (toplevel); | |||
5131 | panel_toplevel_hide (toplevel, TRUE(!(0)), -1); | |||
5132 | } else | |||
5133 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5134 | } | |||
5135 | } | |||
5136 | ||||
5137 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "auto-hide-size"); | |||
5138 | } | |||
5139 | ||||
5140 | int | |||
5141 | panel_toplevel_get_auto_hide_size (PanelToplevel *toplevel) | |||
5142 | { | |||
5143 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), DEFAULT_AUTO_HIDE_SIZE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (1); } } while (0); | |||
5144 | ||||
5145 | return toplevel->priv->auto_hide_size; | |||
5146 | } | |||
5147 | ||||
5148 | void | |||
5149 | panel_toplevel_set_x (PanelToplevel *toplevel, | |||
5150 | int x, | |||
5151 | int x_right, | |||
5152 | gboolean x_centered) | |||
5153 | { | |||
5154 | gboolean changed = FALSE(0); | |||
5155 | ||||
5156 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5157 | ||||
5158 | x_centered = x_centered != FALSE(0); | |||
5159 | ||||
5160 | g_object_freeze_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
5161 | ||||
5162 | if (toplevel->priv->x != x) { | |||
5163 | toplevel->priv->x = x; | |||
5164 | changed = TRUE(!(0)); | |||
5165 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x"); | |||
5166 | } | |||
5167 | ||||
5168 | if (toplevel->priv->x_right != x_right) { | |||
5169 | toplevel->priv->x_right = x_right; | |||
5170 | changed = TRUE(!(0)); | |||
5171 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x-right"); | |||
5172 | } | |||
5173 | ||||
5174 | if (toplevel->priv->x_centered != x_centered) { | |||
5175 | toplevel->priv->x_centered = x_centered; | |||
5176 | changed = TRUE(!(0)); | |||
5177 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "x-centered"); | |||
5178 | } | |||
5179 | ||||
5180 | if (changed) | |||
5181 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5182 | ||||
5183 | g_object_thaw_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
5184 | } | |||
5185 | ||||
5186 | void | |||
5187 | panel_toplevel_set_y (PanelToplevel *toplevel, | |||
5188 | int y, | |||
5189 | int y_bottom, | |||
5190 | gboolean y_centered) | |||
5191 | { | |||
5192 | gboolean changed = FALSE(0); | |||
5193 | ||||
5194 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5195 | ||||
5196 | y_centered = y_centered != FALSE(0); | |||
5197 | ||||
5198 | g_object_freeze_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
5199 | ||||
5200 | if (toplevel->priv->y != y) { | |||
5201 | toplevel->priv->y = y; | |||
5202 | changed = TRUE(!(0)); | |||
5203 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y"); | |||
5204 | } | |||
5205 | ||||
5206 | if (toplevel->priv->y_bottom != y_bottom) { | |||
5207 | toplevel->priv->y_bottom = y_bottom; | |||
5208 | changed = TRUE(!(0)); | |||
5209 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y-bottom"); | |||
5210 | } | |||
5211 | ||||
5212 | if (toplevel->priv->y_centered != y_centered) { | |||
5213 | toplevel->priv->y_centered = y_centered; | |||
5214 | changed = TRUE(!(0)); | |||
5215 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "y-centered"); | |||
5216 | } | |||
5217 | ||||
5218 | if (changed) | |||
5219 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5220 | ||||
5221 | g_object_thaw_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2))))))))); | |||
5222 | } | |||
5223 | ||||
5224 | void | |||
5225 | panel_toplevel_get_position (PanelToplevel *toplevel, | |||
5226 | int *x, | |||
5227 | int *x_right, | |||
5228 | int *y, | |||
5229 | int *y_bottom) | |||
5230 | { | |||
5231 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5232 | ||||
5233 | if (x) | |||
5234 | *x = toplevel->priv->x; | |||
5235 | ||||
5236 | if (y) | |||
5237 | *y = toplevel->priv->y; | |||
5238 | ||||
5239 | if (x_right) | |||
5240 | *x_right = toplevel->priv->x_right; | |||
5241 | ||||
5242 | if (y_bottom) | |||
5243 | *y_bottom = toplevel->priv->y_bottom; | |||
5244 | } | |||
5245 | ||||
5246 | gboolean | |||
5247 | panel_toplevel_get_x_centered (PanelToplevel *toplevel) | |||
5248 | { | |||
5249 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5250 | ||||
5251 | return toplevel->priv->x_centered; | |||
5252 | } | |||
5253 | ||||
5254 | gboolean | |||
5255 | panel_toplevel_get_y_centered (PanelToplevel *toplevel) | |||
5256 | { | |||
5257 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5258 | ||||
5259 | return toplevel->priv->y_centered; | |||
5260 | } | |||
5261 | ||||
5262 | /** | |||
5263 | * panel_toplevel_set_monitor_internal: | |||
5264 | * | |||
5265 | * Sets the monitor of the toplevel, but only the internal state. We need to | |||
5266 | * make the difference between the internal state and the configuration of the | |||
5267 | * user because internal constraints might affect the monitor of the toplevel. | |||
5268 | * | |||
5269 | * panel_toplevel_set_monitor_internal() won't update the configuration of the | |||
5270 | * user. | |||
5271 | **/ | |||
5272 | static void | |||
5273 | panel_toplevel_set_monitor_internal (PanelToplevel *toplevel, | |||
5274 | int monitor, | |||
5275 | gboolean force_resize) | |||
5276 | { | |||
5277 | if (toplevel->priv->monitor == monitor) | |||
5278 | return; | |||
5279 | ||||
5280 | toplevel->priv->monitor = monitor; | |||
5281 | ||||
5282 | if (force_resize) | |||
5283 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5284 | } | |||
5285 | ||||
5286 | /** | |||
5287 | * panel_toplevel_update_monitor: | |||
5288 | * | |||
5289 | * Moves the toplevel to its configured monitor or the first one, if needed. | |||
5290 | * This generally happens when the configured monitor was non-existing before, | |||
5291 | * and it appeared at runtime, or if it was existing and disappeared. | |||
5292 | * | |||
5293 | * This must only be called at the beginning of the size request of the | |||
5294 | * toplevel because it doesn't queue a size request. | |||
5295 | **/ | |||
5296 | static void | |||
5297 | panel_toplevel_update_monitor (PanelToplevel *toplevel) | |||
5298 | { | |||
5299 | /* If we were not using the configured monitor, can we use it now? */ | |||
5300 | if ((toplevel->priv->configured_monitor != -1) && | |||
5301 | (toplevel->priv->configured_monitor != toplevel->priv->monitor) && | |||
5302 | toplevel->priv->configured_monitor < panel_multimonitor_monitors ()) { | |||
5303 | panel_toplevel_set_monitor_internal (toplevel, | |||
5304 | toplevel->priv->configured_monitor, | |||
5305 | FALSE(0)); | |||
5306 | ||||
5307 | /* else, can we still use the monitor we were using? */ | |||
5308 | } else if (toplevel->priv->monitor >= panel_multimonitor_monitors ()) { | |||
5309 | panel_toplevel_set_monitor_internal (toplevel, | |||
5310 | 0, | |||
5311 | FALSE(0)); | |||
5312 | } | |||
5313 | } | |||
5314 | ||||
5315 | void | |||
5316 | panel_toplevel_set_monitor (PanelToplevel *toplevel, | |||
5317 | int monitor) | |||
5318 | { | |||
5319 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5320 | ||||
5321 | if (toplevel->priv->configured_monitor == monitor) | |||
5322 | return; | |||
5323 | ||||
5324 | toplevel->priv->configured_monitor = monitor; | |||
5325 | ||||
5326 | /* Only use the configured monitor if it's existing. Else, we ignore | |||
5327 | * the non-existing monitor, and keep the old one. The main use case is | |||
5328 | * when logging in after having used a multimonitor environment. | |||
5329 | * We will put the panel on the monitor 0 for this session, and it will | |||
5330 | * move back to the right monitor next time. */ | |||
5331 | if (monitor < panel_multimonitor_monitors ()) | |||
5332 | panel_toplevel_set_monitor_internal (toplevel, monitor, TRUE(!(0))); | |||
5333 | ||||
5334 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "monitor"); | |||
5335 | } | |||
5336 | ||||
5337 | int | |||
5338 | panel_toplevel_get_monitor (PanelToplevel *toplevel) | |||
5339 | { | |||
5340 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), -1)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (-1); } } while (0); | |||
5341 | ||||
5342 | return toplevel->priv->monitor; | |||
5343 | } | |||
5344 | ||||
5345 | void | |||
5346 | panel_toplevel_set_auto_hide (PanelToplevel *toplevel, | |||
5347 | gboolean auto_hide) | |||
5348 | { | |||
5349 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5350 | ||||
5351 | auto_hide = auto_hide != FALSE(0); | |||
5352 | ||||
5353 | if (toplevel->priv->auto_hide == auto_hide) | |||
5354 | return; | |||
5355 | ||||
5356 | toplevel->priv->auto_hide = auto_hide; | |||
5357 | ||||
5358 | if (toplevel->priv->auto_hide) | |||
5359 | panel_toplevel_queue_auto_hide (toplevel); | |||
5360 | else | |||
5361 | panel_toplevel_queue_auto_unhide (toplevel); | |||
5362 | ||||
5363 | if (panel_toplevel_update_struts (toplevel, FALSE(0))) | |||
5364 | ctk_widget_queue_resize (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ()))))))); | |||
5365 | ||||
5366 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "auto-hide"); | |||
5367 | } | |||
5368 | ||||
5369 | gboolean | |||
5370 | panel_toplevel_get_auto_hide (PanelToplevel *toplevel) | |||
5371 | { | |||
5372 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5373 | ||||
5374 | return toplevel->priv->auto_hide; | |||
5375 | } | |||
5376 | ||||
5377 | void | |||
5378 | panel_toplevel_set_hide_delay (PanelToplevel *toplevel, | |||
5379 | int hide_delay) | |||
5380 | { | |||
5381 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5382 | ||||
5383 | if (toplevel->priv->hide_delay == hide_delay) | |||
5384 | return; | |||
5385 | ||||
5386 | toplevel->priv->hide_delay = hide_delay; | |||
5387 | ||||
5388 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "hide-delay"); | |||
5389 | } | |||
5390 | ||||
5391 | int | |||
5392 | panel_toplevel_get_hide_delay (PanelToplevel *toplevel) | |||
5393 | { | |||
5394 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), -1)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (-1); } } while (0); | |||
5395 | ||||
5396 | return toplevel->priv->hide_delay; | |||
5397 | } | |||
5398 | ||||
5399 | void | |||
5400 | panel_toplevel_set_unhide_delay (PanelToplevel *toplevel, | |||
5401 | int unhide_delay) | |||
5402 | { | |||
5403 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5404 | ||||
5405 | if (toplevel->priv->unhide_delay == unhide_delay) | |||
5406 | return; | |||
5407 | ||||
5408 | toplevel->priv->unhide_delay = unhide_delay; | |||
5409 | ||||
5410 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "unhide-delay"); | |||
5411 | } | |||
5412 | ||||
5413 | int | |||
5414 | panel_toplevel_get_unhide_delay (PanelToplevel *toplevel) | |||
5415 | { | |||
5416 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), -1)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (-1); } } while (0); | |||
5417 | ||||
5418 | return toplevel->priv->unhide_delay; | |||
5419 | } | |||
5420 | ||||
5421 | void | |||
5422 | panel_toplevel_set_anicafe (PanelToplevel *toplevel, | |||
5423 | gboolean anicafe) | |||
5424 | { | |||
5425 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5426 | ||||
5427 | anicafe = anicafe != FALSE(0); | |||
5428 | ||||
5429 | if (toplevel->priv->anicafe == anicafe) | |||
5430 | return; | |||
5431 | ||||
5432 | toplevel->priv->anicafe = anicafe; | |||
5433 | ||||
5434 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "anicafe"); | |||
5435 | } | |||
5436 | ||||
5437 | gboolean | |||
5438 | panel_toplevel_get_anicafe (PanelToplevel *toplevel) | |||
5439 | { | |||
5440 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5441 | ||||
5442 | return toplevel->priv->anicafe; | |||
5443 | } | |||
5444 | ||||
5445 | void | |||
5446 | panel_toplevel_set_animation_speed (PanelToplevel *toplevel, | |||
5447 | PanelAnimationSpeed animation_speed) | |||
5448 | { | |||
5449 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5450 | ||||
5451 | if (toplevel->priv->animation_speed == animation_speed) | |||
5452 | return; | |||
5453 | ||||
5454 | toplevel->priv->animation_speed = animation_speed; | |||
5455 | ||||
5456 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "animation-speed"); | |||
5457 | } | |||
5458 | ||||
5459 | PanelAnimationSpeed | |||
5460 | panel_toplevel_get_animation_speed (PanelToplevel *toplevel) | |||
5461 | { | |||
5462 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (0); } } while (0); | |||
5463 | ||||
5464 | return toplevel->priv->animation_speed; | |||
5465 | } | |||
5466 | ||||
5467 | void | |||
5468 | panel_toplevel_set_enable_buttons (PanelToplevel *toplevel, | |||
5469 | gboolean enable_buttons) | |||
5470 | { | |||
5471 | enable_buttons = enable_buttons != FALSE(0); | |||
5472 | ||||
5473 | if (toplevel->priv->buttons_enabled == enable_buttons) | |||
5474 | return; | |||
5475 | ||||
5476 | toplevel->priv->buttons_enabled = enable_buttons; | |||
5477 | ||||
5478 | panel_toplevel_update_hide_buttons (toplevel); | |||
5479 | ||||
5480 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "buttons-enabled"); | |||
5481 | } | |||
5482 | ||||
5483 | gboolean | |||
5484 | panel_toplevel_get_enable_buttons (PanelToplevel *toplevel) | |||
5485 | { | |||
5486 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5487 | ||||
5488 | return toplevel->priv->buttons_enabled; | |||
5489 | } | |||
5490 | ||||
5491 | void | |||
5492 | panel_toplevel_set_enable_arrows (PanelToplevel *toplevel, | |||
5493 | gboolean enable_arrows) | |||
5494 | { | |||
5495 | g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return; } } while (0); | |||
5496 | ||||
5497 | enable_arrows = enable_arrows != FALSE(0); | |||
5498 | ||||
5499 | if (toplevel->priv->arrows_enabled == enable_arrows) | |||
5500 | return; | |||
5501 | ||||
5502 | toplevel->priv->arrows_enabled = enable_arrows; | |||
5503 | ||||
5504 | panel_toplevel_update_hide_buttons (toplevel); | |||
5505 | ||||
5506 | g_object_notify (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), "arrows-enabled"); | |||
5507 | } | |||
5508 | ||||
5509 | gboolean | |||
5510 | panel_toplevel_get_enable_arrows (PanelToplevel *toplevel) | |||
5511 | { | |||
5512 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5513 | ||||
5514 | return toplevel->priv->arrows_enabled; | |||
5515 | } | |||
5516 | ||||
5517 | void | |||
5518 | panel_toplevel_rotate (PanelToplevel *toplevel, | |||
5519 | gboolean clockwise) | |||
5520 | { | |||
5521 | PanelOrientation orientation; | |||
5522 | ||||
5523 | /* Relies on PanelOrientation definition: | |||
5524 | * | |||
5525 | * typedef enum { | |||
5526 | * PANEL_ORIENTATION_TOP = 1 << 0, | |||
5527 | * PANEL_ORIENTATION_RIGHT = 1 << 1, | |||
5528 | * PANEL_ORIENTATION_BOTTOM = 1 << 2, | |||
5529 | * PANEL_ORIENTATION_LEFT = 1 << 3 | |||
5530 | * } PanelOrientation; | |||
5531 | */ | |||
5532 | ||||
5533 | orientation = toplevel->priv->orientation; | |||
5534 | ||||
5535 | if (clockwise) | |||
5536 | orientation <<= 1; | |||
5537 | else | |||
5538 | orientation >>= 1; | |||
5539 | ||||
5540 | if (orientation == 0) | |||
5541 | orientation = PANEL_ORIENTATION_LEFT; | |||
5542 | ||||
5543 | else if (orientation > PANEL_ORIENTATION_LEFT) | |||
5544 | orientation = PANEL_ORIENTATION_TOP; | |||
5545 | ||||
5546 | panel_toplevel_set_orientation (toplevel, orientation); | |||
5547 | } | |||
5548 | ||||
5549 | PanelState | |||
5550 | panel_toplevel_get_state (PanelToplevel *toplevel) | |||
5551 | { | |||
5552 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), 0)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return (0); } } while (0); | |||
5553 | ||||
5554 | return toplevel->priv->state; | |||
5555 | } | |||
5556 | ||||
5557 | gboolean | |||
5558 | panel_toplevel_get_is_hidden (PanelToplevel *toplevel) | |||
5559 | { | |||
5560 | g_return_val_if_fail (PANEL_IS_TOPLEVEL (toplevel), FALSE)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((toplevel)); GType __t = ((panel_toplevel_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "PANEL_IS_TOPLEVEL (toplevel)"); return ((0)); } } while (0); | |||
5561 | ||||
5562 | if (toplevel->priv->state == PANEL_STATE_HIDDEN_UP || | |||
5563 | toplevel->priv->state == PANEL_STATE_HIDDEN_DOWN || | |||
5564 | toplevel->priv->state == PANEL_STATE_HIDDEN_LEFT || | |||
5565 | toplevel->priv->state == PANEL_STATE_HIDDEN_RIGHT) | |||
5566 | return TRUE(!(0)); | |||
5567 | ||||
5568 | return FALSE(0); | |||
5569 | } | |||
5570 | ||||
5571 | int | |||
5572 | panel_toplevel_get_minimum_size (PanelToplevel *toplevel) | |||
5573 | { | |||
5574 | return calculate_minimum_height (CTK_WIDGET (toplevel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_widget_get_type ())))))), | |||
5575 | toplevel->priv->orientation); | |||
5576 | } | |||
5577 | ||||
5578 | int | |||
5579 | panel_toplevel_get_maximum_size (PanelToplevel *toplevel) | |||
5580 | { | |||
5581 | CdkRectangle monitor_geom; | |||
5582 | ||||
5583 | panel_toplevel_get_monitor_geometry (toplevel, &monitor_geom); | |||
5584 | ||||
5585 | if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK(PANEL_ORIENTATION_TOP | PANEL_ORIENTATION_BOTTOM)) | |||
5586 | return monitor_geom.height / MAXIMUM_SIZE_SCREEN_RATIO5; | |||
5587 | else | |||
5588 | return monitor_geom.width / MAXIMUM_SIZE_SCREEN_RATIO5; | |||
5589 | } |