comparison src/video/x11/SDL_x11window.c @ 3078:81d15ace9129

indent
author Sam Lantinga <slouken@libsdl.org>
date Thu, 19 Feb 2009 06:49:59 +0000
parents 9b58f26ede81
children 494559cc723b
comparison
equal deleted inserted replaced
3077:9b58f26ede81 3078:81d15ace9129
120 window->flags &= ~SDL_WINDOW_SHOWN; 120 window->flags &= ~SDL_WINDOW_SHOWN;
121 } 121 }
122 } 122 }
123 123
124 { 124 {
125 Atom _NET_WM_STATE = XInternAtom(data->videodata->display, "_NET_WM_STATE", False); 125 Atom _NET_WM_STATE =
126 Atom _NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(data->videodata->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); 126 XInternAtom(data->videodata->display, "_NET_WM_STATE", False);
127 Atom _NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(data->videodata->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); 127 Atom _NET_WM_STATE_MAXIMIZED_VERT =
128 XInternAtom(data->videodata->display,
129 "_NET_WM_STATE_MAXIMIZED_VERT", False);
130 Atom _NET_WM_STATE_MAXIMIZED_HORZ =
131 XInternAtom(data->videodata->display,
132 "_NET_WM_STATE_MAXIMIZED_HORZ", False);
128 Atom actualType; 133 Atom actualType;
129 int actualFormat; 134 int actualFormat;
130 unsigned long i, numItems, bytesAfter; 135 unsigned long i, numItems, bytesAfter;
131 unsigned char *propertyValue = NULL; 136 unsigned char *propertyValue = NULL;
132 long maxLength = 1024; 137 long maxLength = 1024;
133 138
134 if (XGetWindowProperty(data->videodata->display, w, _NET_WM_STATE, 139 if (XGetWindowProperty(data->videodata->display, w, _NET_WM_STATE,
135 0l, maxLength, False, XA_ATOM, &actualType, &actualFormat, 140 0l, maxLength, False, XA_ATOM, &actualType,
136 &numItems, &bytesAfter, &propertyValue) == Success) { 141 &actualFormat, &numItems, &bytesAfter,
137 Atom *atoms = (Atom *)propertyValue; 142 &propertyValue) == Success) {
143 Atom *atoms = (Atom *) propertyValue;
138 int maximized = 0; 144 int maximized = 0;
139 145
140 for (i = 0; i < numItems; ++i) { 146 for (i = 0; i < numItems; ++i) {
141 if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) { 147 if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
142 maximized |= 1; 148 maximized |= 1;
143 } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) { 149 } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
144 maximized |= 2; 150 maximized |= 2;
145 } 151 }
146 /* Might also want to check the following properties: 152 /* Might also want to check the following properties:
147 _NET_WM_STATE_ABOVE, _NET_WM_STATE_FULLSCREEN 153 _NET_WM_STATE_ABOVE, _NET_WM_STATE_FULLSCREEN
148 */ 154 */
149 } 155 }
150 if (maximized == 3) { 156 if (maximized == 3) {
151 window->flags |= SDL_WINDOW_MAXIMIZED; 157 window->flags |= SDL_WINDOW_MAXIMIZED;
152 } 158 }
153 XFree(propertyValue); 159 XFree(propertyValue);
901 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 907 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
902 SDL_DisplayData *displaydata = 908 SDL_DisplayData *displaydata =
903 (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; 909 (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
904 Display *display = data->videodata->display; 910 Display *display = data->videodata->display;
905 Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", False); 911 Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", False);
906 Atom _NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False); 912 Atom _NET_WM_STATE_MAXIMIZED_VERT =
907 Atom _NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); 913 XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
914 Atom _NET_WM_STATE_MAXIMIZED_HORZ =
915 XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
908 XEvent e; 916 XEvent e;
909 917
910 e.xany.type = ClientMessage; 918 e.xany.type = ClientMessage;
911 e.xany.window = data->window; 919 e.xany.window = data->window;
912 e.xclient.message_type = _NET_WM_STATE; 920 e.xclient.message_type = _NET_WM_STATE;
913 e.xclient.format = 32; 921 e.xclient.format = 32;
914 e.xclient.data.l[0] = maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; 922 e.xclient.data.l[0] =
923 maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
915 e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT; 924 e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT;
916 e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ; 925 e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
917 e.xclient.data.l[3] = 0l; 926 e.xclient.data.l[3] = 0l;
918 e.xclient.data.l[4] = 0l; 927 e.xclient.data.l[4] = 0l;
919 928
920 XSendEvent(display, RootWindow(display, displaydata->screen), 0, 929 XSendEvent(display, RootWindow(display, displaydata->screen), 0,
921 SubstructureNotifyMask|SubstructureRedirectMask, &e); 930 SubstructureNotifyMask | SubstructureRedirectMask, &e);
922 } 931 }
923 932
924 void 933 void
925 X11_MaximizeWindow(_THIS, SDL_Window * window) 934 X11_MaximizeWindow(_THIS, SDL_Window * window)
926 { 935 {