1 /* 2 (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) 3 (c) Copyright 2000-2004 Convergence (integrated media) GmbH 4 5 All rights reserved. 6 7 Written by Denis Oliver Kropp <dok@directfb.org>, 8 Andreas Hundt <andi@fischlustig.de>, 9 Sven Neumann <neo@directfb.org>, 10 Ville Syrjälä <syrjala@sci.fi> and 11 Claudio Ciccani <klan@users.sf.net>. 12 13 This library is free software; you can redistribute it and/or 14 modify it under the terms of the GNU Lesser General Public 15 License as published by the Free Software Foundation; either 16 version 2 of the License, or (at your option) any later version. 17 18 This library is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 Lesser General Public License for more details. 22 23 You should have received a copy of the GNU Lesser General Public 24 License along with this library; if not, write to the 25 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 29 #ifndef __UNIQUE__INTERNAL_H__ 30 #define __UNIQUE__INTERNAL_H__ 31 32 #include <directfb.h> 33 34 #include <direct/list.h> 35 36 #include <fusion/object.h> 37 #include <fusion/vector.h> 38 39 #include <core/coretypes.h> 40 #include <core/windows.h> 41 42 #include <unique/context.h> 43 #include <unique/decoration.h> 44 #include <unique/device.h> 45 #include <unique/input_events.h> 46 #include <unique/stret.h> 47 #include <unique/types.h> 48 #include <unique/window.h> 49 50 51 #define UNIQUE_WM_ABI_VERSION 12 52 53 54 extern const StretRegionClass unique_root_region_class; 55 extern const StretRegionClass unique_frame_region_class; 56 extern const StretRegionClass unique_window_region_class; 57 extern const StretRegionClass unique_foo_region_class; 58 59 extern const UniqueDeviceClass unique_pointer_device_class; 60 extern const UniqueDeviceClass unique_wheel_device_class; 61 extern const UniqueDeviceClass unique_keyboard_device_class; 62 63 typedef enum { 64 URCI_ROOT, 65 URCI_FRAME, 66 URCI_WINDOW, 67 URCI_FOO, 68 69 _URCI_NUM 70 } UniqueRegionClassIndex; 71 72 typedef enum { 73 UFI_N, 74 UFI_NE, 75 UFI_E, 76 UFI_SE, 77 UFI_S, 78 UFI_SW, 79 UFI_W, 80 UFI_NW 81 } UniqueFooIndex; 82 83 typedef ReactionResult (*UniqueWMContextNotify)( WMData *data, 84 const UniqueContextNotification *notification, 85 void *ctx ); 86 87 typedef ReactionResult (*UniqueWMWindowNotify) ( WMData *data, 88 const UniqueWindowNotification *notification, 89 void *ctx ); 90 91 92 struct __UniQuE_WMData { 93 int module_abi; 94 95 CoreDFB *core; 96 FusionWorld *world; 97 98 WMShared *shared; 99 100 UniqueWMContextNotify context_notify; 101 UniqueWMWindowNotify window_notify; 102 }; 103 104 struct __UniQuE_WMShared { 105 int magic; 106 107 FusionObjectPool *context_pool; 108 FusionObjectPool *decoration_pool; 109 FusionObjectPool *window_pool; 110 111 StretRegionClassID region_classes[_URCI_NUM]; 112 UniqueDeviceClassID device_classes[_UDCI_NUM]; 113 114 int device_listener; /* index of the registered global */ 115 116 DFBInsets insets; 117 118 DFBRectangle foo_rects[8]; 119 120 CoreSurface *foo_surface; 121 }; 122 123 124 typedef enum { 125 UNRL_DESKTOP, /* Icons, redirected fullscreen apps (force-desktop) */ 126 UNRL_USER, /* User windows (all currently available stacking classes) */ 127 UNRL_SYSTEM, /* Dock/Panel, Glass, Expos?, Clipboard, Virtual Keyboard, IMs */ 128 UNRL_CURSOR, /* Cursor shape and attached objects, e.g. Drag'N'Drop */ 129 UNRL_SCREEN, /* Display Locking, Screensaver */ 130 131 _UNRL_NUM 132 } UniqueRootLevel; 133 134 typedef enum { 135 UNFL_BACKGROUND, /* Background for blended content, effects, decorations */ 136 UNFL_CONTENT, /* The actual DirectFB Window, i.e. its content */ 137 UNFL_FOREGROUND, /* Decorations, effects, any other content overlay */ 138 139 _UNFL_NUM 140 } UniqueFrameLevel; 141 142 typedef struct { 143 DirectLink link; 144 145 DFBInputDeviceKeySymbol symbol; 146 DFBInputDeviceModifierMask modifiers; 147 148 UniqueWindow *owner; 149 } GrabbedKey; 150 151 152 struct __UniQuE_UniqueContext { 153 FusionObject object; 154 155 int magic; 156 157 CoreWindowStack *stack; 158 WMShared *shared; 159 160 CoreLayerRegion *region; 161 CoreSurface *surface; 162 163 DFBDisplayLayerID layer_id; 164 165 bool active; 166 167 DFBColor color; 168 169 int width; 170 int height; 171 172 StretRegion *root; 173 174 FusionVector windows; 175 176 177 UniqueInputSwitch *input_switch; 178 179 UniqueDevice *devices[_UDCI_NUM]; 180 181 GlobalReaction cursor_reaction; 182 183 FusionSHMPoolShared *shmpool; 184 185 UniqueInputChannel *foo_channel; 186 187 CoreSurface *cursor_bs; /* backing store for region under cursor */ 188 bool cursor_bs_valid; 189 DFBRegion cursor_region; 190 bool cursor_drawn; 191 }; 192 193 struct __UniQuE_UniqueWindow { 194 FusionObject object; 195 196 int magic; 197 198 CoreWindow *window; 199 UniqueContext *context; 200 WMShared *shared; 201 202 CoreSurface *surface; 203 204 UniqueInputChannel *channel; 205 GlobalReaction channel_reaction; 206 207 DirectLink *filters; 208 209 DFBWindowCapabilities caps; 210 211 UniqueWindowFlags flags; 212 213 StretRegion *frame; 214 StretRegion *region; 215 StretRegion *foos[8]; 216 DFBPoint foo_motion; 217 218 DFBInsets insets; 219 220 DFBRectangle bounds; /* absolute bounds of the content */ 221 DFBRectangle full; /* absolute bounds of the full frame */ 222 223 int opacity; /* global alpha factor */ 224 225 DFBWindowStackingClass stacking; /* level boundaries */ 226 int priority; /* derived from stacking class */ 227 228 DFBWindowOptions options; /* flags for appearance/behaviour */ 229 DFBWindowEventType events; /* mask of enabled events */ 230 231 u32 color_key; /* transparent pixel */ 232 DFBRegion opaque; /* region of the window forced to be opaque */ 233 }; 234 235 struct __UniQuE_UniqueDecoration { 236 FusionObject object; 237 238 int magic; 239 240 UniqueWindow *window; 241 UniqueContext *context; 242 243 UniqueDecorationFlags flags; 244 }; 245 246 struct __UniQuE_UniqueDecorationItem { 247 const UniqueLayout *layout; 248 249 DFBPoint pos; /* current offset from window origin */ 250 DFBDimension size; /* current dimensions */ 251 }; 252 253 struct __UniQuE_StretRegion { 254 int magic; 255 256 StretRegion *parent; /* Is NULL for the root region. */ 257 258 int level; /* Level within the parent. */ 259 int index; /* Index within the level. */ 260 261 int levels; /* Number of levels provided. */ 262 FusionVector *children; /* Children of each level. */ 263 264 StretRegionFlags flags; /* Control appearance and activity. */ 265 266 DFBRegion bounds; /* Relative to its parent. */ 267 268 StretRegionClassID clazz; /* Region class (implementation) used for rendering etc. */ 269 270 void *data; /* Optional private data of region class. */ 271 unsigned long arg; /* Optional argument for region class instance. */ 272 273 FusionSHMPoolShared *shmpool; 274 }; 275 276 struct __UniQuE_UniqueDevice { 277 int magic; 278 279 UniqueContext *context; 280 281 UniqueDeviceClassID clazz; /* Device class (implementation) used for processing etc. */ 282 283 void *data; /* Optional private data of device class. */ 284 void *ctx; /* Optional context for device class instance. */ 285 286 FusionReactor *reactor; /* UniqueInputEvent deployment */ 287 288 DirectLink *connections; /* CoreInputDevice connections */ 289 }; 290 291 292 struct __UniQuE_UniqueInputFilter { 293 DirectLink link; 294 295 int magic; 296 297 UniqueDeviceClassIndex index; 298 299 UniqueInputChannel *channel; 300 301 UniqueInputEvent filter; 302 }; 303 304 typedef struct { 305 UniqueDeviceClassID clazz; 306 307 UniqueInputChannel *current; 308 309 UniqueInputChannel *normal; 310 UniqueInputChannel *fixed; 311 312 UniqueInputChannel *implicit; 313 314 DirectLink *filters; 315 } UniqueInputTarget; 316 317 318 struct __UniQuE_UniqueInputSwitch { 319 int magic; 320 321 UniqueContext *context; 322 323 DirectLink *connections; /* UniqueDevice connections */ 324 325 int x; 326 int y; 327 328 UniqueInputTarget targets[_UDCI_NUM]; 329 }; 330 331 struct __UniQuE_UniqueInputChannel { 332 int magic; 333 334 UniqueContext *context; 335 336 FusionReactor *reactor; /* UniqueInputEvent arrival */ 337 }; 338 339 340 DFBResult unique_wm_module_init ( CoreDFB *core, 341 WMData *data, 342 WMShared *shared, 343 bool master ); 344 345 void unique_wm_module_deinit( WMData *data, 346 WMShared *shared, 347 bool master, 348 bool emergency ); 349 350 UniqueContext *unique_wm_create_context( void ); 351 UniqueDecoration *unique_wm_create_decoration( void ); 352 UniqueWindow *unique_wm_create_window( void ); 353 354 /* HACK: temporary, will move into cursor class */ 355 void unique_draw_cursor( CoreWindowStack *stack, UniqueContext *context, CardState *state, DFBRegion *region ); 356 357 358 /* global reactions */ 359 ReactionResult _unique_device_listener ( const void *msg_data, 360 void *ctx ); 361 362 ReactionResult _unique_wm_module_context_listener ( const void *msg_data, 363 void *ctx ); 364 365 ReactionResult _unique_wm_module_window_listener ( const void *msg_data, 366 void *ctx ); 367 368 ReactionResult _unique_cursor_device_listener ( const void *msg_data, 369 void *ctx ); 370 371 ReactionResult _unique_input_switch_device_listener ( const void *msg_data, 372 void *ctx ); 373 374 ReactionResult _unique_window_input_channel_listener( const void *msg_data, 375 void *ctx ); 376 377 #endif 378 379