gcsx_gui.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /* GCSx
  2. ** GUI.H
  3. **
  4. ** Base gui classes and code
  5. */
  6. /*****************************************************************************
  7. ** Copyright (C) 2003-2006 Janson
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  22. *****************************************************************************/
  23. #ifndef __GCSx_GUI_H_
  24. #define __GCSx_GUI_H_
  25. // Virtual base class for Window and Desktop
  26. class WindowParent {
  27. public:
  28. virtual int getScreenX() const = 0;
  29. virtual int getScreenY() const = 0;
  30. virtual void setChildDirty() = 0;
  31. virtual void childMoved(int fromX, int fromY, int toX, int toY, class Window* child) = 0;
  32. virtual void childResized(int fromW, int fromH, int toW, int toH, class Window* child) = 0;
  33. virtual void childDeleted(Window* child) = 0;
  34. virtual void childModified(Window* child) = 0; // Usage varies by child window type
  35. virtual void siblingModified(Window* sibling) = 0; // Usage varies by window type
  36. virtual ~WindowParent() = 0;
  37. };
  38. class Window : public virtual WindowParent {
  39. protected:
  40. int x, y, width, height;
  41. WindowParent* parent; // Could be a Window, or desktop, or NULL
  42. WindowParent* parentNotify; // We notify this window if we are deleted- nothing more!
  43. // (how much of us is viewable based on parent window telling us- -1 if unknown)
  44. int viewWidth, viewHeight;
  45. // Unique ID across all windows
  46. int id;
  47. static int nextId;
  48. // Are we visible, and therefore need to update/redraw?
  49. // This is true if width and height are >0 and parent is non-NULL
  50. // and viewWidth/Height are non-zero
  51. int visible;
  52. int dirty; // If we need to redraw ourselves
  53. int childDirty; // If a child of ours needs to redraw
  54. // If we need to redraw entirely from scratch (only set by ::resize normally)
  55. // If a window doesn't check this (ie, if it normally repaints totally anyways)
  56. // you don't need to zero it out. Many windows repaint totally, so this is
  57. // usually ignored, but you can create a window that tracks partial repaints
  58. // and this should then trigger a full repaint.
  59. int totalDirty;
  60. // Default GUI routines only call this with total=1; your routines, if they
  61. // set partial dirties, need to track the partialness in your own variables
  62. void setDirty(int total = 0);
  63. public:
  64. enum WindowType {
  65. // Window types- client windows are windows within a frame window
  66. // Widget windows are subwindows within a client window
  67. WINDOW_UNKNOWN,
  68. WINDOW_POPUPMENU,
  69. WINDOW_MENUBAR,
  70. WINDOW_FRAME,
  71. WINDOW_DIALOG,
  72. WINDOW_CLIENT,
  73. WINDOW_WIDGET,
  74. WINDOW_TOOLTIP,
  75. WINDOW_LASTTYPE = WINDOW_WIDGET,
  76. };
  77. enum WindowSort {
  78. // Window sort priorities
  79. WINDOWSORT_DESKTOP,
  80. WINDOWSORT_NORMAL,
  81. WINDOWSORT_ONTOP,
  82. WINDOWSORT_DOCKED,
  83. WINDOWSORT_MODAL,
  84. WINDOWSORT_POPUP,
  85. };
  86. // Whether to hide, disable, or enable a command in a popup menu
  87. enum CommandSupport {
  88. COMMAND_HIDE = 0,
  89. COMMAND_DISABLE = 1,
  90. COMMAND_ENABLE = 2,
  91. COMMAND_CHECKBOX = 4,
  92. COMMAND_RADIO = 8,
  93. COMMAND_SELECTED = 16,
  94. };
  95. Window();
  96. virtual ~Window();
  97. void setParent(WindowParent* wParent);
  98. void setParentNotify(WindowParent* wParentNotify);
  99. WindowParent* getParent() const { return parent; }
  100. void setChildDirty();
  101. // When a child resizes or moves, it calls one of these to tell us to
  102. // set appropriate dirtiness; the default versions of these do NOTHING
  103. virtual void childMoved(int fromX, int fromY, int toX, int toY, Window* child);
  104. virtual void childResized(int fromW, int fromH, int toW, int toH, Window* child);
  105. // Called when we are the parent or parentnotify of a child that is just about to be deleted
  106. virtual void childDeleted(Window* child);
  107. // Called by child windows when they "modify"- usage is up to the child windows
  108. // i.e. dialog widgets use this commonly; other windows may never use it
  109. // Default behavior propogates upward without modifying pointer (i.e. passes up
  110. // a grandchild pointer)
  111. virtual void childModified(Window* child);
  112. // Called by parent windows when a sibling was modified- usage is up to the
  113. // windows in question- mostly used by dialogs and frame wiondows
  114. // Default behavior is to do nothing
  115. virtual void siblingModified(Window* sibling);
  116. // Called when resolution changes; 0 for from if first resolution set
  117. virtual void resolutionChange(int fromW, int fromH, int fromBpp, int toW, int toH, int toBpp);
  118. #ifndef NDEBUG
  119. virtual const char* debugDump() const;
  120. #endif
  121. // x/y position includes any scrollbar-induced offset
  122. virtual void move(int xPos, int yPos);
  123. // (this function accepts zero/negative values as "hidden"- minimized- which
  124. // unsets visible member))
  125. // fromParent is true if parent is telling us to resize and we don't need to
  126. // propogate it back (normally we'll tell our parent if we resize and our parent
  127. // is a container such as a frame window)
  128. // 'view' size is the amount of us that we can see, may be larger or smaller
  129. // than our actual width or height; -1 means unchanged; this is
  130. // used by frame windows and other containers to tell us that, if we want,
  131. // we can optimize our displays, resizes, and storage to this amount of surface
  132. virtual void resize(int newWidth, int newHeight, int newViewWidth = -1, int newViewHeight = -1, int fromParent = 0);
  133. // Returns true if closing is ok; false if close should abort (save dialog, for example)
  134. // This doesn't actually close the window- use an SDL_CLOSE event for that
  135. virtual int attemptClose();
  136. // Return true if event was used
  137. // Note that keyboard events typically -only- go to the window with focus
  138. // Mouse events typically -only- go to the window with mousefocus, and coordinates are adjusted
  139. // This function is NOT allowed to modify the event
  140. // Only SDL_CLOSE events are allowed to delete windows, and only children
  141. // (parent always deletes a window)
  142. // If you wish to close otherwise, issue an appropriate SDL_CLOSE event
  143. // Focus events should be careful if they also trigger focus changes, to prevent infinite loops
  144. // This function must not open a modal dialog or new event loop due to any of these events-
  145. // SDL_QUIT, SDL_ACTIVEEVENT, SDL_VIDEORESIZE, SDL_VIDEOEXPOSE, SDL_IDLE
  146. // Any event that opens a modal dialog or event loop must be on an object that is thread-
  147. // safe for these events- (it will still receive these events while it's waiting on modal)
  148. // SDL_ACTIVEEVENT, SDL_VIDEORESIZE, SDL_VIDEOEXPOSE, SDL_IDLE
  149. virtual int event(int hasFocus, const SDL_Event* event) = 0;
  150. // Do we need to be redrawn, or one of our children?
  151. int isDirty() const;
  152. // Return true if this paints using an alpha blend, IE windows below must be repainted first
  153. /* Not currently used or supported
  154. virtual int usesAlpha() const;
  155. */
  156. // Return true if this window wants to be deleted by it's parent when closed
  157. // If false, code elsewhere handles it's deletion (for example, config dialogs
  158. // are static and global, and only deleted on exit)
  159. // This is used by Frame windows, Dialog windows, and the desktop, etc.
  160. // This defaults to TRUE
  161. virtual int wantsToBeDeleted() const;
  162. // Return true if this window is currently a docked part of the user interface
  163. // (such as a menu) This affects where other windows can move/resize to
  164. virtual int isDocked() const;
  165. // Return true if this window, when active, doesn't prevent the previous window
  166. // from appearing active; when inactive, returns to that previous window. (used
  167. // for popups and menus)
  168. virtual int tempFocus() const;
  169. // Return true if this window doesn't want any focus or events at all
  170. virtual int refuseAll() const;
  171. // Return whether this window supports the given SDL_COMMAND- used to disable
  172. // or hide menu options that aren't appropriate for the current menu
  173. virtual CommandSupport supportsCommand(int code) const;
  174. // Return type and sort of window
  175. // MUST return WINDOWSORT_MODAL if a modal window!
  176. // This can't be done via RTTI as there is not a one-to-one relationship to
  177. // classes (for example, menu class returns both memubar and popup types)
  178. virtual WindowType windowType() const;
  179. virtual WindowSort windowSort() const;
  180. // Display to surface (don't flip/update screen)
  181. // toDisplay is the rectangle that MUST be updated per parent/desktop request
  182. // and is gaurunteed to be within your x/w/size; clipArea is your clipping area
  183. // and may extend further than your size and will always contain toDisplay
  184. // Always set a clip rectangle on destSurface before drawing- either clipArea
  185. // or a subrectangle of clipArea
  186. // offset tells you what coordinate is your 0/0
  187. // toDisplay and clipArea are fully x/y based (not 0-based)
  188. // If no required update, toDisplay will have width of zero
  189. // display() must store the actual updated area back into toDisplay, which
  190. // should have been clipped by clipArea
  191. virtual void display(SDL_Surface* destSurface, Rect& toDisplay, const Rect& clipArea, int xOffset, int yOffset) = 0;
  192. // Return true if this window or it's parent is currently part of the desktop
  193. int isOnDesktop() const;
  194. // Closes this window or it's parent via an SDL_CLOSE event
  195. // Does NOT call attemptClose() if you set skipAttempt true
  196. void closeWindow(int skipAttempt = 0);
  197. // Returns pointer to tooltip to display; x/y relative to window
  198. // Return NULL for none
  199. virtual const char* tooltip(int xPos, int yPos) const;
  200. // Are coordinates within our boundaries?
  201. int isCoords(int xPos, int yPos) const;
  202. int getX() const;
  203. int getY() const;
  204. int getWidth() const;
  205. int getHeight() const;
  206. int getId() const;
  207. void getRect(Rect& rect) const;
  208. // Gets actual on-screen position
  209. int getScreenX() const;
  210. int getScreenY() const;
  211. // Receives undo/redo notifications, if appropriate
  212. virtual void undoNotify(int undoType, int undoItemId, int undoItemSubId, int uX, int uY, int uW, int uH);
  213. };
  214. // Used to hold and organize windows, for a desktop, or within another window
  215. // Doesn't contain any actual code to display the windows to screen
  216. class WindowCollection : public virtual WindowParent {
  217. protected:
  218. // (internal gui data regarding windows and focus)
  219. // List so that iterators work even if elements change
  220. std::list<Window*> windowDataDisplay; // Windows in display order
  221. std::list<Window*> windowDataFocus; // Windows in focus order
  222. Window* currentFocus;
  223. Window* previousFocus; // (last window with focus when a tempFocus window is active)
  224. Window* lastFocus; // (window with input focus when we lost our own focus, ie app change)
  225. Window* currentMouseFocus;
  226. int lastMouseX;
  227. int lastMouseY;
  228. // Allow clicking outside any windows?
  229. int allowDesktopClick;
  230. // (if a modal window is defined, no window below it can accept events or focus)
  231. Window* modalPos;
  232. // What we need to update next refresh
  233. Rect updateRect;
  234. // How large our "canvas" is for windows- after subtracting docked windows and
  235. // menus. This is only used by child classes that care, such as Desktop.
  236. int overallWidth;
  237. int overallHeight;
  238. int canvasX;
  239. int canvasY;
  240. int canvasWidth;
  241. int canvasHeight;
  242. int windowRunEvent(Window* target, const SDL_Event* event);
  243. const Window* findWindowByCoords(int x, int y) const;
  244. Window* findWindowByCoords(int x, int y);
  245. // (sendMoveEvent sends a custom-generated mouse movement event to
  246. // reconfirm mouse position if focus has changed)
  247. Window* recheckMouseFocus(int sendMoveEvent = 0);
  248. // (toTop should always be true except when called from bringToTop)
  249. // Returns true if a focus change was made
  250. int changeInputFocus(Window* window, int toTop = 1);
  251. // Scans all windows for docked windows and adjusts our canvas, if we're
  252. // using that feature
  253. void adjustCanvas();
  254. // Used to handle broadcast-type events, mostly SDL_COMMAND, SDL_IDLE
  255. int (*handleEvents)(const SDL_Event* event);
  256. // Add something to our refresh rect
  257. void addToUpdateRect(const Rect& add);
  258. public:
  259. WindowCollection();
  260. virtual ~WindowCollection();
  261. // Called when resolution changes; 0 for from if first resolution set
  262. void resolutionChange(int fromW, int fromH, int fromBpp, int toW, int toH, int toBpp);
  263. // Sets the function to catch SDL_COMMAND, SDL_IDLE, and other broadcast events
  264. // Not called on SDL_COMMAND if another window uses it
  265. void setEventHandler(int (*eventHandler)(const SDL_Event* event));
  266. // Add or remove Window from the collection (adds to top of z-order for the window's sort type)
  267. // Note that if addWindow fails, window will not be added, so it won't ever be closed and delete itself
  268. void addWindow(Window* item, int giveFocus = 1);
  269. // (this MUST BE CALLED to remove a window that's been deleted)
  270. void removeWindow(Window* item);
  271. // pos = 0 for first, 1 for second, etc.
  272. // Scans in focus order, returning lowest window first
  273. Window* findWindow(Window::WindowType type, int pos);
  274. // Verifies that a specific window is on desktop
  275. int verifyWindow(const Window* target) const;
  276. Window* verifyWindow(int targetId);
  277. // returns window with input focus
  278. Window* findFocusWindow();
  279. // returns window with previous input focus, or current if no previous
  280. Window* findPreviousFocusWindow();
  281. // Bring to top or bottom (item must already be part of collection)
  282. void bringToTop(Window* item, int giveFocus = 1);
  283. void sendToBottom(Window* item); // Loses focus unless only window
  284. // Handles an untouched event and propogates it to the proper
  285. // window or windows. Returns true if event was used. After this function,
  286. // any window pointers could poitn to closed windows.
  287. int handleEvent(const SDL_Event* event);
  288. };
  289. class Desktop : public WindowCollection {
  290. protected:
  291. // Quit state is global to all event loops- once a quit is requested, all
  292. // loops above and below will quit.
  293. int quit; // Any non-zero value is a quit, and can represent a "quit type"
  294. int preQuit;
  295. int cancelPreQuit;
  296. int eventLoopCount;
  297. int modalReturn;
  298. int eventCleanup; // Ignore mouse/keyboard events until queue is clean
  299. // If a child of ours needs redrawing
  300. int childDirty;
  301. // Location and time of last left mouse click, to check for double-click
  302. int dclickX;
  303. int dclickY;
  304. int dclickTicks;
  305. enum {
  306. // Double-click sensitivity, in time (ms) and distance (max pixels)
  307. DOUBLECLICK_TIME = 1000,
  308. DOUBLECLICK_DIST = 2,
  309. // Phase rotation schedule
  310. DELAY_PHASE_ROTATE = 60,
  311. // Tooltip delay
  312. DELAY_TOOLTIP_SHOW = 1000,
  313. // Short and long timeouts (long repeats)
  314. DELAY_IDLE_SHORT = 3000,
  315. DELAY_IDLE_LONG = 60000,
  316. };
  317. // Global phase for selection rectangles and glowing cursors
  318. int cursorPhase;
  319. int cursorAlpha;
  320. int selectionPhase;
  321. Uint32 selectionPhaseMs;
  322. // Idle timeout
  323. Uint32 idleTimeout;
  324. int didShortTimeout;
  325. int didLongTimeout;
  326. // Current tooltip, time until tooltip should show
  327. class ToolTip* tooltip;
  328. Uint32 tooltipMs;
  329. // Keypad-to-regular sym conversion
  330. static SDLKey keypadConvert[10];
  331. // Background
  332. SDL_Surface* backgroundImage;
  333. int bkSrcX;
  334. int bkSrcY;
  335. int bkSrcW;
  336. int bkSrcH;
  337. int bkDestX;
  338. int bkDestY;
  339. int backgroundColorIndex;
  340. int backgroundAlpha;
  341. // Game loop (optional)
  342. void (*gameLoopH)(int);
  343. // Global function for dynamic popups
  344. Window::CommandSupport (*supportsCommandH)(int code);
  345. public:
  346. int lastShortcutKey;
  347. Desktop();
  348. virtual ~Desktop();
  349. void setBackground(SDL_Surface* image, int colorIndex);
  350. void setBackgroundAlpha(int alpha); // openGL only, 0-256
  351. // (also enables desktop clicking)
  352. void setGameLoop(void (*gameLoop)(int));
  353. int currentSelectionPhase() const { return selectionPhase; }
  354. int currentCursorAlpha() const { return cursorAlpha; }
  355. void setChildDirty();
  356. void childMoved(int fromX, int fromY, int toX, int toY, Window* child);
  357. void childResized(int fromW, int fromH, int toW, int toH, Window* child);
  358. void childDeleted(Window* child);
  359. void childModified(Window* child);
  360. void siblingModified(Window* sibling);
  361. // Broadcast a custom event
  362. // For example, broadcastEvent(SDL_COMMAND, command_code);
  363. // Can pass a single exempt window which will NOT receive the event
  364. // runImmediate recurses it to event loop immediately, and returns result-
  365. // intended for use by desktop event handler only
  366. // Otherwise returns 0
  367. int broadcastEvent(int type, int code, void* data = NULL, Window* exempt = NULL, int runImmediate = 0);
  368. // SDL_OBJECTCHANGE events always go out *IMMEDIATELY* (interrupting current work)
  369. // @TODO: all uses of this should pass (and expect) the base (OR EDIT?) form of the object
  370. // for exampe, Scene and Layer, not SceneEdit or LayerEdit
  371. void broadcastObjChange(int code, void* object, int data1, int data2, Window* exempt = NULL);
  372. // Send a focus or close event to a specific window
  373. // Cancels sending anything if window is NULL
  374. // For example, focusEvent(SDL_MOUSEFOCUS, 1, window);
  375. // Only intended for focus/close events
  376. // This is the correct and ONLY way for a window to request a window,
  377. // including itself, to close (use SDL_CLOSE)
  378. // Note that SDL_CLOSE events always go to the very front of the queue, so
  379. // no other events will process first, for safety
  380. void focusEvent(int type, int code, Window* window);
  381. // Main draw/event loop; also used for modal dialogs
  382. // Returns value returned by a modal dialog, 0 if none was returned (closed by mistake?)
  383. // Main event loop always returns 0
  384. int eventLoop();
  385. // Updates screen (use during loops to modify onscreen without using threads)
  386. void updateScreen();
  387. // Ignore all keyboard/mouse events (ie user interaction) until event queue clears
  388. // Good if you lock things up for a short period, to prevent invalid clicks
  389. void initEventCleanup();
  390. // Closes and clears all windows off the desktop immediately
  391. void closeAllWindows();
  392. // Deletes all windows off the desktop, no user prompts, no events
  393. void deleteAllWindows();
  394. // Call during a modal dialog upon closing to tell inner event loop what value to return
  395. void setModalReturn(int returnValue);
  396. // Call during a SDL_PREQUIT event to cancel the quit
  397. void cancelQuit();
  398. // Call to find out if we're cancelling a quit; use this so that you
  399. // stop propogating a SDL_PREQUIT event once it's been cancelled
  400. int cancelQuitState();
  401. // Sets the function to check global support for a popup command
  402. // Presumably, if this function returns "supported", the global event handler will handle it
  403. void setSupportsHandler(Window::CommandSupport (*supportsHandler)(int code));
  404. // Call global support handler; pass prior response, this will combine them
  405. Window::CommandSupport supportsCommand(int code, Window::CommandSupport prior) const;
  406. // Desktop size relative to entire screen, MINUS docked windows
  407. int desktopX() const;
  408. int desktopY() const;
  409. int desktopWidth() const;
  410. int desktopHeight() const;
  411. int getScreenX() const;
  412. int getScreenY() const;
  413. // Called when resolution changes; 0 for from if first resolution set
  414. void resolutionChange(int fromW, int fromH, int fromBpp, int toW, int toH, int toBpp);
  415. // Cancels any possibility of a double click- use when initiating
  416. // "fake" clicks or other situations where double clicks are not desired
  417. void preventDoubleClick();
  418. };
  419. // Used for SDL_OBJECTCHANGE events
  420. struct ObjChange {
  421. const void* obj;
  422. int info1;
  423. int info2;
  424. };
  425. // Custom event types
  426. enum {
  427. // Lose or gain mouse focus- code 0 lose 1 gain, data1 window
  428. // code &2 if parent FRAME window still has focus, just on another child
  429. // (may later expand &2 functionality to dialogs)
  430. SDL_MOUSEFOCUS = SDL_USEREVENT,
  431. // Lose or gain input focus- code 0 lose 1 gain, data1 window
  432. // code &2 if parent FRAME window still has focus, just on another child
  433. // (may later expand &2 functionality to dialogs)
  434. SDL_INPUTFOCUS,
  435. // Command (from a menu or accelerator) code in 'code' member
  436. SDL_COMMAND,
  437. // Close window, data1 window
  438. // (not a request, but a demand- any pre-close should have already ran)
  439. SDL_CLOSE,
  440. // Pre-quit, idle, etc- sub event in 'code'
  441. SDL_SPECIAL,
  442. // Broadcast/system key
  443. SDL_SYSKEY,
  444. // Double-click left mouse button- otherwise same as SDL_MOUSEBUTTONDOWN
  445. SDL_MOUSEBUTTONDBL,
  446. // Called when various game objects update, to tell needed windows to update
  447. // code contains one OBJ_ and one or more OBJMOD_ constants OR'd together
  448. // data1 points to a ObjChange structure
  449. SDL_OBJECTCHANGE,
  450. // Sub events for SDL_SPECIAL- stored in 'code'
  451. // Pre-quit, can be cancelled (prompt for saving, etc.)
  452. SDL_PREQUIT = 1,
  453. // Close game
  454. SDL_CLOSEGAME = 2,
  455. // Desktop now 'active' or not 'active' window (if enabled during gameplay mode)
  456. SDL_DESKTOPACTIVE = 3,
  457. SDL_DESKTOPINACTIVE = 4,
  458. // Special types of quits
  459. SDL_SPECIALQUIT = 64, // Set at 64 so you can go & SDL_SPECIALQUIT
  460. SDL_QUITTOEDITOR = 65,
  461. SDL_QUITTOFRONT = 66,
  462. SDL_QUITTOGAME = 67,
  463. // Idle- set at 128 so you can go & SDL_IDLE to check for this or any
  464. // idle-derived event like IDLEPHASE
  465. SDL_IDLE = 128,
  466. // Idle with cursor glow and selection phase change
  467. SDL_IDLEPHASE = 129,
  468. // Idle with cursor glow
  469. SDL_IDLECURSOR = 130,
  470. // Idle short timeout (no activity for 3 sec, as defined in enum)
  471. SDL_IDLETIMEOUTSHORT = 131,
  472. // Idle long timeout (no activity every 60 sec, as defined in enum)
  473. SDL_IDLETIMEOUTLONG = 132,
  474. };
  475. // The main desktop
  476. extern Desktop* desktop;
  477. // Combines an SDLKey and either KMOD_CTRL, KMOD_SHIFT, KMOD_ALT, or a combo
  478. // to a single value
  479. #define combineKey(sym, mod) (((mod) << 16) | (sym))
  480. #endif