Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 969 vs 970 for /trunk/Source Code/Core/WindowManager.cpp

Diff revisions: vs.
  @@ -87,10 +87,18 @@
87 87
88 88 WindowDescriptor descriptor;
89 89 descriptor.dimensions = initialResolution;
90 - descriptor.fullscreen = startFullScreen;
91 90 descriptor.targetDisplay = targetDisplayIndex;
92 91 descriptor.title = _context->config().title;
93 92
93 + SetBit(descriptor.flags, WindowDescriptor::Flags::HIDDEN);
94 +
95 + if (startFullScreen) {
96 + SetBit(descriptor.flags, WindowDescriptor::Flags::FULLSCREEN);
97 + }
98 + if (!_context->config().runtime.windowResizable) {
99 + ClearBit(descriptor.flags, WindowDescriptor::Flags::RESIZEABLE);
100 + }
101 +
94 102 ErrorCode err = ErrorCode::NO_ERR;
95 103
96 104 U32 idx = createWindow(descriptor, err);
  @@ -130,7 +138,7 @@
130 138 for (DisplayWindow* window : _windows) {
131 139 window->destroyWindow();
132 140 }
133 -
141 + _windows.clear();
134 142 SDL_QuitSubSystem(SDL_INIT_VIDEO);
135 143 }
136 144
  @@ -141,8 +149,24 @@
141 149 if (window != nullptr) {
142 150 ret = to_U32(_windows.size());
143 151 _windows.emplace_back(window);
144 - err = _windows[ret]->init(_apiFlags,
145 - descriptor.fullscreen ? WindowType::FULLSCREEN : WindowType::WINDOW,
152 +
153 + U32 mainWindowFlags = _apiFlags;
154 + if (BitCompare(descriptor.flags, to_base(WindowDescriptor::Flags::RESIZEABLE))) {
155 + mainWindowFlags |= SDL_WINDOW_RESIZABLE;
156 + }
157 + if (BitCompare(descriptor.flags, to_base(WindowDescriptor::Flags::ALLOW_HIGH_DPI))) {
158 + mainWindowFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
159 + }
160 + if (BitCompare(descriptor.flags, to_base(WindowDescriptor::Flags::HIDDEN))) {
161 + mainWindowFlags |= SDL_WINDOW_HIDDEN;
162 + }
163 + if (!BitCompare(descriptor.flags, to_base(WindowDescriptor::Flags::DECORATED))) {
164 + mainWindowFlags |= SDL_WINDOW_BORDERLESS;
165 + }
166 + bool fullscreen = BitCompare(descriptor.flags, to_base(WindowDescriptor::Flags::FULLSCREEN));
167 +
168 + err = _windows[ret]->init(mainWindowFlags,
169 + fullscreen ? WindowType::FULLSCREEN : WindowType::WINDOW,
146 170 descriptor.dimensions,
147 171 descriptor.title.c_str());
148 172
  @@ -150,12 +174,17 @@
150 174 _windows.pop_back();
151 175 MemoryManager::SAFE_DELETE(window);
152 176 }
177 + _windows[ret]->clearColour(descriptor.clearColour);
153 178 }
154 179
155 180 return ret;
156 181 }
157 182
158 183 bool WindowManager::destroyWindow(DisplayWindow*& window) {
184 + if (window == nullptr) {
185 + return true;
186 + }
187 +
159 188 SDL_HideWindow(window->getRawWindow());
160 189 I64 targetGUID = window->getGUID();
161 190 if (window->destroyWindow() == ErrorCode::NO_ERR) {
  @@ -324,12 +353,6 @@
324 353 windowFlags |= SDL_WINDOW_OPENGL;
325 354 }
326 355
327 - windowFlags |= SDL_WINDOW_HIDDEN;
328 - windowFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
329 - if (_context->config().runtime.windowResizable) {
330 - windowFlags |= SDL_WINDOW_RESIZABLE;
331 - }
332 -
333 356 return windowFlags;
334 357 }
335 358
  @@ -401,7 +424,8 @@
401 424 if (_mainWindowGUID == winGUID) {
402 425 handleWindowEvent(WindowEvent::APP_QUIT, -1, -1, -1);
403 426 } else {
404 - for (DisplayWindow* win : _windows) {
427 +
428 + for (DisplayWindow*& win : _windows) {
405 429 if (win->getGUID() == winGUID) {
406 430 if (!destroyWindow(win)) {
407 431 Console::errorfn(Locale::get(_ID("WINDOW_CLOSE_EVENT_ERROR")), winGUID);