1 /* 2 * Copyright © 2020 Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 16 * 17 * Authors: Matthias Clasen <mclasen@redhat.com> 18 */ 19 20 #ifndef __GDK_TOPLEVEL_H__ 21 #define __GDK_TOPLEVEL_H__ 22 23 #if !defined(__GDK_H_INSIDE__) && !defined(GTK_COMPILATION) 24 #error "Only <gdk/gdk.h> can be included directly." 25 #endif 26 27 #include <gdk/gdkseat.h> 28 #include <gdk/gdksurface.h> 29 #include <gdk/gdktoplevellayout.h> 30 31 G_BEGIN_DECLS 32 33 /** 34 * GdkSurfaceEdge: 35 * @GDK_SURFACE_EDGE_NORTH_WEST: the top left corner. 36 * @GDK_SURFACE_EDGE_NORTH: the top edge. 37 * @GDK_SURFACE_EDGE_NORTH_EAST: the top right corner. 38 * @GDK_SURFACE_EDGE_WEST: the left edge. 39 * @GDK_SURFACE_EDGE_EAST: the right edge. 40 * @GDK_SURFACE_EDGE_SOUTH_WEST: the lower left corner. 41 * @GDK_SURFACE_EDGE_SOUTH: the lower edge. 42 * @GDK_SURFACE_EDGE_SOUTH_EAST: the lower right corner. 43 * 44 * Determines a surface edge or corner. 45 */ 46 typedef enum 47 { 48 GDK_SURFACE_EDGE_NORTH_WEST, 49 GDK_SURFACE_EDGE_NORTH, 50 GDK_SURFACE_EDGE_NORTH_EAST, 51 GDK_SURFACE_EDGE_WEST, 52 GDK_SURFACE_EDGE_EAST, 53 GDK_SURFACE_EDGE_SOUTH_WEST, 54 GDK_SURFACE_EDGE_SOUTH, 55 GDK_SURFACE_EDGE_SOUTH_EAST 56 } GdkSurfaceEdge; 57 58 /** 59 * GdkFullscreenMode: 60 * @GDK_FULLSCREEN_ON_CURRENT_MONITOR: Fullscreen on current monitor only. 61 * @GDK_FULLSCREEN_ON_ALL_MONITORS: Span across all monitors when fullscreen. 62 * 63 * Indicates which monitor a surface should span over when in fullscreen mode. 64 */ 65 typedef enum 66 { 67 GDK_FULLSCREEN_ON_CURRENT_MONITOR, 68 GDK_FULLSCREEN_ON_ALL_MONITORS 69 } GdkFullscreenMode; 70 71 /** 72 * GdkToplevelState: 73 * @GDK_TOPLEVEL_STATE_MINIMIZED: the surface is minimized 74 * @GDK_TOPLEVEL_STATE_MAXIMIZED: the surface is maximized 75 * @GDK_TOPLEVEL_STATE_STICKY: the surface is sticky 76 * @GDK_TOPLEVEL_STATE_FULLSCREEN: the surface is maximized without decorations 77 * @GDK_TOPLEVEL_STATE_ABOVE: the surface is kept above other surfaces 78 * @GDK_TOPLEVEL_STATE_BELOW: the surface is kept below other surfaces 79 * @GDK_TOPLEVEL_STATE_FOCUSED: the surface is presented as focused (with active decorations) 80 * @GDK_TOPLEVEL_STATE_TILED: the surface is in a tiled state 81 * @GDK_TOPLEVEL_STATE_TOP_TILED: whether the top edge is tiled 82 * @GDK_TOPLEVEL_STATE_TOP_RESIZABLE: whether the top edge is resizable 83 * @GDK_TOPLEVEL_STATE_RIGHT_TILED: whether the right edge is tiled 84 * @GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE: whether the right edge is resizable 85 * @GDK_TOPLEVEL_STATE_BOTTOM_TILED: whether the bottom edge is tiled 86 * @GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable 87 * @GDK_TOPLEVEL_STATE_LEFT_TILED: whether the left edge is tiled 88 * @GDK_TOPLEVEL_STATE_LEFT_RESIZABLE: whether the left edge is resizable 89 * 90 * Specifies the state of a toplevel surface. 91 * 92 * On platforms that support information about individual edges, the 93 * %GDK_TOPLEVEL_STATE_TILED state will be set whenever any of the individual 94 * tiled states is set. On platforms that lack that support, the tiled state 95 * will give an indication of tiledness without any of the per-edge states 96 * being set. 97 */ 98 typedef enum 99 { 100 GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 0, 101 GDK_TOPLEVEL_STATE_MAXIMIZED = 1 << 1, 102 GDK_TOPLEVEL_STATE_STICKY = 1 << 2, 103 GDK_TOPLEVEL_STATE_FULLSCREEN = 1 << 3, 104 GDK_TOPLEVEL_STATE_ABOVE = 1 << 4, 105 GDK_TOPLEVEL_STATE_BELOW = 1 << 5, 106 GDK_TOPLEVEL_STATE_FOCUSED = 1 << 6, 107 GDK_TOPLEVEL_STATE_TILED = 1 << 7, 108 GDK_TOPLEVEL_STATE_TOP_TILED = 1 << 8, 109 GDK_TOPLEVEL_STATE_TOP_RESIZABLE = 1 << 9, 110 GDK_TOPLEVEL_STATE_RIGHT_TILED = 1 << 10, 111 GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE = 1 << 11, 112 GDK_TOPLEVEL_STATE_BOTTOM_TILED = 1 << 12, 113 GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE = 1 << 13, 114 GDK_TOPLEVEL_STATE_LEFT_TILED = 1 << 14, 115 GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15 116 } GdkToplevelState; 117 118 typedef enum 119 { 120 GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1, 121 GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2, 122 GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3 123 } GdkTitlebarGesture; 124 125 126 #define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ()) 127 128 GDK_AVAILABLE_IN_ALL 129 G_DECLARE_INTERFACE (GdkToplevel, gdk_toplevel, GDK, TOPLEVEL, GObject) 130 131 GDK_AVAILABLE_IN_ALL 132 void gdk_toplevel_present (GdkToplevel *toplevel, 133 GdkToplevelLayout *layout); 134 135 GDK_AVAILABLE_IN_ALL 136 gboolean gdk_toplevel_minimize (GdkToplevel *toplevel); 137 138 GDK_AVAILABLE_IN_ALL 139 gboolean gdk_toplevel_lower (GdkToplevel *toplevel); 140 141 GDK_AVAILABLE_IN_ALL 142 void gdk_toplevel_focus (GdkToplevel *toplevel, 143 guint32 timestamp); 144 145 GDK_AVAILABLE_IN_ALL 146 GdkToplevelState gdk_toplevel_get_state (GdkToplevel *toplevel); 147 148 GDK_AVAILABLE_IN_ALL 149 void gdk_toplevel_set_title (GdkToplevel *toplevel, 150 const char *title); 151 152 GDK_AVAILABLE_IN_ALL 153 void gdk_toplevel_set_startup_id (GdkToplevel *toplevel, 154 const char *startup_id); 155 156 GDK_AVAILABLE_IN_ALL 157 void gdk_toplevel_set_transient_for (GdkToplevel *toplevel, 158 GdkSurface *parent); 159 160 GDK_AVAILABLE_IN_ALL 161 void gdk_toplevel_set_modal (GdkToplevel *toplevel, 162 gboolean modal); 163 164 GDK_AVAILABLE_IN_ALL 165 void gdk_toplevel_set_icon_list (GdkToplevel *toplevel, 166 GList *surfaces); 167 168 GDK_AVAILABLE_IN_ALL 169 gboolean gdk_toplevel_show_window_menu (GdkToplevel *toplevel, 170 GdkEvent *event); 171 172 GDK_AVAILABLE_IN_ALL 173 void gdk_toplevel_set_decorated (GdkToplevel *toplevel, 174 gboolean decorated); 175 176 GDK_AVAILABLE_IN_ALL 177 void gdk_toplevel_set_deletable (GdkToplevel *toplevel, 178 gboolean deletable); 179 GDK_AVAILABLE_IN_ALL 180 gboolean gdk_toplevel_supports_edge_constraints (GdkToplevel *toplevel); 181 182 GDK_AVAILABLE_IN_ALL 183 void gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel, 184 GdkEvent *event); 185 186 GDK_AVAILABLE_IN_ALL 187 void gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel); 188 189 GDK_AVAILABLE_IN_ALL 190 void gdk_toplevel_begin_resize (GdkToplevel *toplevel, 191 GdkSurfaceEdge edge, 192 GdkDevice *device, 193 int button, 194 double x, 195 double y, 196 guint32 timestamp); 197 198 GDK_AVAILABLE_IN_ALL 199 void gdk_toplevel_begin_move (GdkToplevel *toplevel, 200 GdkDevice *device, 201 int button, 202 double x, 203 double y, 204 guint32 timestamp); 205 206 GDK_AVAILABLE_IN_4_4 207 gboolean gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel, 208 GdkTitlebarGesture gesture); 209 210 G_END_DECLS 211 212 #endif /* __GDK_TOPLEVEL_H__ */ 213