Mercurial > sdl-ios-xcode
annotate src/video/directfb/SDL_DirectFB_WM.c @ 5067:61d53410eb41
Fixed bug #859
CREATE_SUBDIRS helps a lot if browsing HTML documentation in a file browser.
ALWAYS_DETAILED_SEC makes sure everything has at least the automatic
documentation like function prototype and source references.
STRIP_FROM_PATH allows you to include only the relevant portions of the files'
paths, cleaning up both the file list and directory tree, though you need to
change the path listed here to match wherever you put SDL.
ALIASES avoids some warnings generated by
C:\source\svn.libsdl.org\trunk\SDL\src\joystick\darwin\10.3.9-FIX\IOHIDLib.h.
It seems Apple uses a few commands which are not normally supported by Doxygen.
BUILTIN_STL_SUPPORT adds support for parsing code which makes use of the
standard template library. There isn't a lot of C++ in SDL (some in bwindow at
least), but this still seems like a good idea.
TYPEDEF_HIDES_STRUCT means that for code like this:
typedef struct A {int B;} C;
C is documented as a structure containing B instead of a typedef mapped to A.
EXTRACT_ALL, EXTRACT_PRIVATE, EXTRACT_STATIC, EXTRACT_LOCAL_METHODS,
EXTRACT_ANON_NSPACES and INTERNAL_DOCS make sure that _everything_ is
documented.
CASE_SENSE_NAMES = NO avoids potential conflicts when building documentation on
case insensitive file systems like NTFS and FAT32.
WARN_NO_PARAMDOC lets you know when you have documented some, but not all, of
the parameters of a function. This is useful when you're working on adding
such documentation since it makes partially documented functions easier to
spot.
WARN_LOGFILE writes warnings to a seperate file instead of mixing them in with
stdout. When not running in quiet mode, these warnings can be hard to spot
without this flag.
I added *.h.in and *.h.default to FILE_PATTERNS to generate documentation for
config.h.in and config.h.default.
RECURSIVE tells doxygen to look not only in the input directory, but also in
subfolders.
EXCLUDE avoids documenting things like test programs, examples and templates
which need to be documented separately.
I've used EXCLUDE_PATTERNS to exclude non-source subdirectories that often find
their way into source folders (such as obj or .svn).
EXAMPLE_PATH lists directories doxygen will search to find included example
code. So far, SDL doesn't really use this feature, but I've listed some likely
locations.
SOURCE_BROWSER adds syntax highlighted source code to the HTML output.
USE_HTAGS is nice, but not available on Windows.
INLINE_SOURCES adds the body of a function to it's documentation so you can
quickly see exactly what it does.
ALPHABETICAL_INDEX generates an alphabetical list of all structures, functions,
etc., which makes it much easier to find what you're looking for.
IGNORE_PREFIX skips the SDL_ prefix when deciding which index page to place an
item on so you don't have everything show up under "S".
HTML_DYNAMIC_SECTIONS hides the includes/included by diagrams by default and
adds JavaScript to allow the user to show and hide them by clicking a link.
ENUM_VALUES_PER_LINE = 1 makes enums easier to read by placing each value on
it's own line.
GENERATE_TREEVIEW produces a two frame index page with a navigation tree on the
left.
I have LaTeX and man pages turned off to speed up doxygen, you may want to turn
them back on yourself.
I added _WIN32=1 to PREDEFINED to cause SDL to output documentation related to
Win32 builds of SDL. Normally, doxygen gets confused since there are multiple
definitions for various structures and formats that vary by platform. Without
this doxygen can produce broken documentation or, if you're lucky, output
documentation only for the dummy drivers, which isn't very useful. You need to
pick a platform.
GENERATE_TAGFILE produces a file which can be used to link other doxygen
documentation to the SDL documentation.
CLASS_DIAGRAMS turns on class diagrams even when dot is not available.
HAVE_DOT tells doxygen to try to use dot to generate diagrams.
TEMPLATE_RELATIONS and INCLUDE_GRAPH add additional diagrams to the
documentation.
DOT_MULTI_TARGETS speeds up dot.
OUTPUT_DIRECTORY, INPUT and other paths reflect the fact that this Doxyfile is
intended to process src as well as include and is being run from a separate
subdirectory. Doxygen produces several temporary files while it's running and
if interrupted, can leave those files behind. It's easier to clean up if there
aren't a hundred or so files in the same folder. I typically run doxygen in
SDL/doxy and set the output directory to '.'. Since doxygen puts it's output
in subfolders by type, this keeps things pretty well organised. You could use
'../doc' instead and get the same results.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 21 Jan 2011 12:57:01 -0800 |
parents | b196d2758026 |
children | 164f20ba08eb |
rev | line source |
---|---|
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
1 /* |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
4 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
9 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
14 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
18 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
19 Sam Lantinga |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
20 slouken@libsdl.org |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
21 */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
23 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
24 //#include "SDL_syswm.h" |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
25 //#include "../SDL_sysvideo.h" |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
26 //#include "../../events/SDL_keyboard_c.h" |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
27 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
28 #include "SDL_DirectFB_video.h" |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
29 |
4636 | 30 #include "../../events/SDL_windowevents_c.h" |
31 | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
32 #define COLOR_EXPAND(col) col.r, col.g, col.b, col.a |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
33 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
34 static DFB_Theme theme_std = { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
35 4, 4, 8, 8, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
36 {255, 200, 200, 200}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
37 24, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
38 {255, 0, 0, 255}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
39 16, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
40 {255, 255, 255, 255}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
41 "/usr/share/fonts/truetype/freefont/FreeSans.ttf", |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
42 {255, 255, 0, 0}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
43 {255, 255, 255, 0}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
44 }; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
45 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
46 static DFB_Theme theme_none = { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
47 0, 0, 0, 0, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
48 {0, 0, 0, 0}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
49 0, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
50 {0, 0, 0, 0}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
51 0, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
52 {0, 0, 0, 0}, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
53 NULL |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
54 }; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
55 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
56 static void |
4636 | 57 DrawTriangle(IDirectFBSurface * s, int down, int x, int y, int w) |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
58 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
59 int x1, x2, x3; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
60 int y1, y2, y3; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
61 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
62 if (down) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
63 x1 = x + w / 2; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
64 x2 = x; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
65 x3 = x + w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
66 y1 = y + w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
67 y2 = y; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
68 y3 = y; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
69 } else { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
70 x1 = x + w / 2; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
71 x2 = x; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
72 x3 = x + w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
73 y1 = y; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
74 y2 = y + w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
75 y3 = y + w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
76 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
77 s->FillTriangle(s, x1, y1, x2, y2, x3, y3); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
78 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
79 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
80 static void |
4636 | 81 LoadFont(_THIS, SDL_Window * window) |
82 { | |
83 SDL_DFB_DEVICEDATA(_this); | |
84 SDL_DFB_WINDOWDATA(window); | |
85 | |
86 if (windata->font != NULL) { | |
87 SDL_DFB_RELEASE(windata->font); | |
88 windata->font = NULL; | |
89 SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font)); | |
90 } | |
91 | |
92 if (windata->theme.font != NULL) | |
93 { | |
94 DFBFontDescription fdesc; | |
95 | |
96 SDL_zero(fdesc); | |
97 fdesc.flags = DFDESC_HEIGHT; | |
98 fdesc.height = windata->theme.font_size; | |
99 SDL_DFB_CHECK(devdata-> | |
100 dfb->CreateFont(devdata->dfb, windata->theme.font, | |
101 &fdesc, &windata->font)); | |
102 SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font)); | |
103 } | |
104 } | |
105 | |
106 static void | |
107 DrawCraption(_THIS, IDirectFBSurface * s, int x, int y, char *text) | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
108 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
109 DFBSurfaceTextFlags flags; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
110 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
111 flags = DSTF_CENTER | DSTF_TOP; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
112 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
113 s->DrawString(s, text, -1, x, y, flags); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
114 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
115 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
116 void |
4636 | 117 DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window) |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
118 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
119 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
120 IDirectFBSurface *s = windata->window_surface; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
121 DFB_Theme *t = &windata->theme; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
122 int i; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
123 int d = (t->caption_size - t->font_size) / 2; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
124 int x, y, w; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
125 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
126 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
127 if (!windata->is_managed || (window->flags & SDL_WINDOW_FULLSCREEN)) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
128 return; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
129 |
4636 | 130 LoadFont(_this, window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
131 //s->SetDrawingFlags(s, DSDRAW_BLEND); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
132 s->SetColor(s, COLOR_EXPAND(t->frame_color)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
133 /* top */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
134 for (i = 0; i < t->top_size; i++) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
135 s->DrawLine(s, 0, i, windata->size.w, i); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
136 /* bottom */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
137 for (i = windata->size.h - t->bottom_size; i < windata->size.h; i++) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
138 s->DrawLine(s, 0, i, windata->size.w, i); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
139 /* left */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
140 for (i = 0; i < t->left_size; i++) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
141 s->DrawLine(s, i, 0, i, windata->size.h); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
142 /* right */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
143 for (i = windata->size.w - t->right_size; i < windata->size.w; i++) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
144 s->DrawLine(s, i, 0, i, windata->size.h); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
145 /* Caption */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
146 s->SetColor(s, COLOR_EXPAND(t->caption_color)); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
147 s->FillRectangle(s, t->left_size, t->top_size, windata->client.w, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
148 t->caption_size); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
149 /* Close Button */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
150 w = t->caption_size; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
151 x = windata->size.w - t->right_size - w + d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
152 y = t->top_size + d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
153 s->SetColor(s, COLOR_EXPAND(t->close_color)); |
4636 | 154 DrawTriangle(s, 1, x, y, w - 2 * d); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
155 /* Max Button */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
156 s->SetColor(s, COLOR_EXPAND(t->max_color)); |
4636 | 157 DrawTriangle(s, window->flags & SDL_WINDOW_MAXIMIZED ? 1 : 0, x - w, |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
158 y, w - 2 * d); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
159 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
160 /* Caption */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
161 if (window->title) { |
4636 | 162 s->SetColor(s, COLOR_EXPAND(t->font_color)); |
163 DrawCraption(_this, s, (x - w) / 2, t->top_size + d, window->title); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
164 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
165 /* Icon */ |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
166 if (windata->icon) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
167 DFBRectangle dr; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
168 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
169 dr.x = t->left_size + d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
170 dr.y = t->top_size + d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
171 dr.w = w - 2 * d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
172 dr.h = w - 2 * d; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
173 s->SetBlittingFlags(s, DSBLIT_BLEND_ALPHACHANNEL); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
174 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
175 s->StretchBlit(s, windata->icon, NULL, &dr); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
176 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
177 windata->wm_needs_redraw = 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
178 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
179 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
180 DFBResult |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
181 DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
182 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
183 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
184 |
4636 | 185 SDL_DFB_CHECK(windata->window->GetSize(windata->window, cw, ch)); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
186 *cw -= windata->theme.left_size + windata->theme.right_size; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
187 *ch -= |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
188 windata->theme.top_size + windata->theme.caption_size + |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
189 windata->theme.bottom_size; |
4636 | 190 return DFB_OK; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
191 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
192 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
193 void |
4636 | 194 DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h) |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
195 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
196 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
197 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
198 if (!windata->is_managed) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
199 windata->theme = theme_none; |
4636 | 200 else if (flags & SDL_WINDOW_FULLSCREEN) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
201 windata->theme = theme_none; |
4636 | 202 } else if (flags & SDL_WINDOW_MAXIMIZED) { |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
203 windata->theme = theme_std; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
204 windata->theme.left_size = 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
205 windata->theme.right_size = 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
206 windata->theme.top_size = 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
207 windata->theme.bottom_size = 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
208 } else { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
209 windata->theme = theme_std; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
210 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
211 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
212 windata->client.x = windata->theme.left_size; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
213 windata->client.y = windata->theme.top_size + windata->theme.caption_size; |
4636 | 214 windata->client.w = w; |
215 windata->client.h = h; | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
216 windata->size.w = |
4636 | 217 w + windata->theme.left_size + windata->theme.right_size; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
218 windata->size.h = |
4636 | 219 h + windata->theme.top_size + |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
220 windata->theme.caption_size + windata->theme.bottom_size; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
221 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
222 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
223 void |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
224 DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
225 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
226 SDL_DFB_WINDOWDATA(window); |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3040
diff
changeset
|
227 SDL_VideoDisplay *display = window->display; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
228 |
4636 | 229 SDL_DFB_CHECK(windata->window->GetPosition(windata->window, |
230 &windata->restore.x, &windata->restore.y)); | |
231 SDL_DFB_CHECK(windata->window->GetSize(windata->window, &windata->restore.w, | |
232 &windata->restore.h)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
233 |
4636 | 234 DirectFB_WM_AdjustWindowLayout(window, window->flags | SDL_WINDOW_MAXIMIZED, display->current_mode.w, display->current_mode.h) ; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
235 |
4636 | 236 SDL_DFB_CHECK(windata->window->MoveTo(windata->window, 0, 0)); |
237 SDL_DFB_CHECK(windata->window->Resize(windata->window, | |
238 display->current_mode.w, display->current_mode.h)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
239 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
240 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
241 void |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
242 DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
243 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
244 SDL_DFB_WINDOWDATA(window); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
245 |
4636 | 246 DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED), |
247 windata->restore.w, windata->restore.h); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
248 |
4636 | 249 SDL_DFB_CHECK(windata->window->Resize(windata->window, windata->restore.w, |
250 windata->restore.h)); | |
251 SDL_DFB_CHECK(windata->window->MoveTo(windata->window, windata->restore.x, | |
252 windata->restore.y)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
253 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
254 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
255 enum |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
256 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
257 WM_POS_NONE = 0x00, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
258 WM_POS_CAPTION = 0x01, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
259 WM_POS_CLOSE = 0x02, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
260 WM_POS_MAX = 0x04, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
261 WM_POS_LEFT = 0x08, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
262 WM_POS_RIGHT = 0x10, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
263 WM_POS_TOP = 0x20, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
264 WM_POS_BOTTOM = 0x40, |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
265 }; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
266 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
267 static int |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
268 WMIsClient(DFB_WindowData * p, int x, int y) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
269 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
270 x -= p->client.x; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
271 y -= p->client.y; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
272 if (x < 0 || y < 0) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
273 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
274 if (x >= p->client.w || y >= p->client.h) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
275 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
276 return 1; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
277 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
278 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
279 static int |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
280 WMPos(DFB_WindowData * p, int x, int y) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
281 { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
282 int pos = WM_POS_NONE; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
283 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
284 if (!WMIsClient(p, x, y)) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
285 if (y < p->theme.top_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
286 pos |= WM_POS_TOP; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
287 } else if (y < p->client.y) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
288 if (x < |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
289 p->size.w - p->theme.right_size - 2 * p->theme.caption_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
290 pos |= WM_POS_CAPTION; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
291 } else if (x < |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
292 p->size.w - p->theme.right_size - |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
293 p->theme.caption_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
294 pos |= WM_POS_MAX; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
295 } else { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
296 pos |= WM_POS_CLOSE; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
297 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
298 } else if (y >= p->size.h - p->theme.bottom_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
299 pos |= WM_POS_BOTTOM; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
300 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
301 if (x < p->theme.left_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
302 pos |= WM_POS_LEFT; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
303 } else if (x >= p->size.w - p->theme.right_size) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
304 pos |= WM_POS_RIGHT; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
305 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
306 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
307 return pos; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
308 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
309 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
310 static int wm_grab; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
311 static int wm_lastx; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
312 static int wm_lasty; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
313 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
314 int |
3040 | 315 DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt) |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
316 { |
4636 | 317 SDL_DFB_DEVICEDATA(_this); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
318 SDL_DFB_WINDOWDATA(window); |
4636 | 319 DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
320 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
321 if (!windata->is_managed) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
322 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
323 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
324 switch (evt->type) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
325 case DWET_BUTTONDOWN: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
326 if (evt->buttons & DIBM_LEFT) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
327 int pos = WMPos(windata, evt->x, evt->y); |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
328 switch (pos) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
329 case WM_POS_NONE: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
330 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
331 case WM_POS_CLOSE: |
4636 | 332 wm_grab = WM_POS_NONE; |
4568 | 333 SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, |
3040 | 334 0); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
335 return 1; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
336 case WM_POS_MAX: |
4636 | 337 wm_grab = WM_POS_NONE; |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
338 if (window->flags & SDL_WINDOW_MAXIMIZED) { |
4636 | 339 SDL_RestoreWindow(window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
340 } else { |
4636 | 341 SDL_MaximizeWindow(window); |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
342 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
343 return 1; |
4636 | 344 case WM_POS_CAPTION: |
345 DirectFB_RaiseWindow(_this, window); | |
346 /* fall through */ | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
347 default: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
348 wm_grab = pos; |
4636 | 349 if (gwindata != NULL) |
350 SDL_DFB_CHECK(gwindata->window->UngrabPointer(gwindata->window)); | |
351 SDL_DFB_CHECK(windata->window->GrabPointer(windata->window)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
352 wm_lastx = evt->cx; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
353 wm_lasty = evt->cy; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
354 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
355 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
356 return 1; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
357 case DWET_BUTTONUP: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
358 break; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
359 case DWET_MOTION: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
360 if (!wm_grab) |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
361 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
362 if (evt->buttons & DIBM_LEFT) { |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
363 int dx = evt->cx - wm_lastx; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
364 int dy = evt->cy - wm_lasty; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
365 int cw, ch; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
366 |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
367 if (wm_grab & WM_POS_CAPTION) |
4636 | 368 SDL_DFB_CHECK(windata->window->Move(windata->window, dx, dy)); |
369 if (wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) { | |
370 if ((wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM) | |
371 dx = 0; | |
372 else if ((wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT) | |
373 dy = 0; | |
374 SDL_DFB_CHECK(windata->window->GetSize(windata->window, &cw, &ch)); | |
375 SDL_DFB_CHECK(windata->window->Resize(windata->window, cw + dx, ch + dy)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
376 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
377 wm_lastx = evt->cx; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
378 wm_lasty = evt->cy; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
379 return 1; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
380 } |
4636 | 381 SDL_DFB_CHECK(windata->window->UngrabPointer(windata->window)); |
382 if (gwindata != NULL) | |
383 SDL_DFB_CHECK(gwindata->window->GrabPointer(gwindata->window)); | |
3023
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
384 wm_grab = WM_POS_NONE; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
385 break; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
386 case DWET_KEYDOWN: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
387 break; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
388 case DWET_KEYUP: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
389 break; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
390 default: |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
391 ; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
392 } |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
393 return 0; |
d72a0dd80e8b
DirectFB cleanups & simple window manager
Couriersud <couriersud@arcor.de>
parents:
diff
changeset
|
394 } |