summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index bc92f111..fb55bb52 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -318,12 +318,12 @@ static iRoot *rootAt_Window_(const iWindow *d, iInt2 coord) {
318 318
319#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 319#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
320static SDL_HitTestResult hitTest_MainWindow_(SDL_Window *win, const SDL_Point *pos, void *data) { 320static SDL_HitTestResult hitTest_MainWindow_(SDL_Window *win, const SDL_Point *pos, void *data) {
321 iWindow *d = data; 321 iMainWindow *d = data;
322 iAssert(d->win == win); 322 iAssert(d->base.win == win);
323 if (SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MOUSE_CAPTURE | SDL_WINDOW_FULLSCREEN_DESKTOP)) { 323 if (SDL_GetWindowFlags(win) & (SDL_WINDOW_MOUSE_CAPTURE | SDL_WINDOW_FULLSCREEN_DESKTOP)) {
324 return SDL_HITTEST_NORMAL; 324 return SDL_HITTEST_NORMAL;
325 } 325 }
326 const int snap = snap_Window(d); 326 const int snap = snap_MainWindow(d);
327 int w, h; 327 int w, h;
328 SDL_GetWindowSize(win, &w, &h); 328 SDL_GetWindowSize(win, &w, &h);
329 /* TODO: Check if inside the caption label widget. */ 329 /* TODO: Check if inside the caption label widget. */
@@ -333,7 +333,7 @@ static SDL_HitTestResult hitTest_MainWindow_(SDL_Window *win, const SDL_Point *p
333 const iBool isBottom = pos->y >= h - gap_UI && snap != yMaximized_WindowSnap; 333 const iBool isBottom = pos->y >= h - gap_UI && snap != yMaximized_WindowSnap;
334 const int captionHeight = lineHeight_Text(uiContent_FontId) + gap_UI * 2; 334 const int captionHeight = lineHeight_Text(uiContent_FontId) + gap_UI * 2;
335 const int rightEdge = left_Rect(bounds_Widget(findChild_Widget( 335 const int rightEdge = left_Rect(bounds_Widget(findChild_Widget(
336 rootAt_Window_(d, init_I2(pos->x, pos->y))->widget, 336 rootAt_Window_(as_Window(d), init_I2(pos->x, pos->y))->widget,
337 "winbar.min"))); 337 "winbar.min")));
338 d->place.lastHit = SDL_HITTEST_NORMAL; 338 d->place.lastHit = SDL_HITTEST_NORMAL;
339 if (snap != maximized_WindowSnap) { 339 if (snap != maximized_WindowSnap) {
@@ -364,8 +364,8 @@ static SDL_HitTestResult hitTest_MainWindow_(SDL_Window *win, const SDL_Point *p
364 return SDL_HITTEST_NORMAL; 364 return SDL_HITTEST_NORMAL;
365} 365}
366 366
367SDL_HitTestResult hitTest_Window(const iWindow *d, iInt2 pos) { 367SDL_HitTestResult hitTest_MainWindow(const iMainWindow *d, iInt2 pos) {
368 return hitTest_Window_(d->win, &(SDL_Point){ pos.x, pos.y }, iConstCast(void *, d)); 368 return hitTest_MainWindow_(d->base.win, &(SDL_Point){ pos.x, pos.y }, iConstCast(void *, d));
369} 369}
370#endif 370#endif
371 371
@@ -387,7 +387,7 @@ iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) {
387#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 387#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
388 if (type_Window(d) == main_WindowType && prefs_App()->customFrame) { 388 if (type_Window(d) == main_WindowType && prefs_App()->customFrame) {
389 /* Register a handler for window hit testing (drag, resize). */ 389 /* Register a handler for window hit testing (drag, resize). */
390 SDL_SetWindowHitTest(d->win, hitTest_Window_, d); 390 SDL_SetWindowHitTest(d->win, hitTest_MainWindow_, d);
391 SDL_SetWindowResizable(d->win, SDL_TRUE); 391 SDL_SetWindowResizable(d->win, SDL_TRUE);
392 } 392 }
393#endif 393#endif
@@ -1453,8 +1453,8 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) {
1453 postCommand_App("window.resized"); 1453 postCommand_App("window.resized");
1454#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 1454#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
1455 /* Update custom frame controls. */{ 1455 /* Update custom frame controls. */{
1456 const iBool hideCtl0 = numRoots_Window(d) != 1; 1456 const iBool hideCtl0 = numRoots_Window(as_Window(d)) != 1;
1457 iWidget *winBar = findChild_Widget(d->roots[0]->widget, "winbar"); 1457 iWidget *winBar = findChild_Widget(d->base.roots[0]->widget, "winbar");
1458 if (winBar) { 1458 if (winBar) {
1459 setFlags_Widget( 1459 setFlags_Widget(
1460 findChild_Widget(winBar, "winbar.min"), hidden_WidgetFlag, hideCtl0); 1460 findChild_Widget(winBar, "winbar.min"), hidden_WidgetFlag, hideCtl0);
@@ -1462,8 +1462,8 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) {
1462 findChild_Widget(winBar, "winbar.max"), hidden_WidgetFlag, hideCtl0); 1462 findChild_Widget(winBar, "winbar.max"), hidden_WidgetFlag, hideCtl0);
1463 setFlags_Widget( 1463 setFlags_Widget(
1464 findChild_Widget(winBar, "winbar.close"), hidden_WidgetFlag, hideCtl0); 1464 findChild_Widget(winBar, "winbar.close"), hidden_WidgetFlag, hideCtl0);
1465 if (d->roots[1]) { 1465 if (d->base.roots[1]) {
1466 winBar = findChild_Widget(d->roots[1]->widget, "winbar"); 1466 winBar = findChild_Widget(d->base.roots[1]->widget, "winbar");
1467 setFlags_Widget( 1467 setFlags_Widget(
1468 findChild_Widget(winBar, "winbar.icon"), hidden_WidgetFlag, iTrue); 1468 findChild_Widget(winBar, "winbar.icon"), hidden_WidgetFlag, iTrue);
1469 setFlags_Widget( 1469 setFlags_Widget(
@@ -1548,8 +1548,8 @@ void setSnap_MainWindow(iMainWindow *d, int snapMode) {
1548 newRect.pos.y += newRect.size.y; 1548 newRect.pos.y += newRect.size.y;
1549 } 1549 }
1550 /* Update window controls. */ 1550 /* Update window controls. */
1551 iForIndices(rootIndex, d->roots) { 1551 iForIndices(rootIndex, d->base.roots) {
1552 iRoot *root = d->roots[rootIndex]; 1552 iRoot *root = d->base.roots[rootIndex];
1553 if (!root) continue; 1553 if (!root) continue;
1554 iWidget *winBar = findChild_Widget(root->widget, "winbar"); 1554 iWidget *winBar = findChild_Widget(root->widget, "winbar");
1555 updateTextCStr_LabelWidget(findChild_Widget(winBar, "winbar.max"), 1555 updateTextCStr_LabelWidget(findChild_Widget(winBar, "winbar.max"),
@@ -1558,8 +1558,8 @@ void setSnap_MainWindow(iMainWindow *d, int snapMode) {
1558 const iBool wasVisible = isVisible_Widget(winBar); 1558 const iBool wasVisible = isVisible_Widget(winBar);
1559 setFlags_Widget(winBar, hidden_WidgetFlag, d->place.snap == fullscreen_WindowSnap); 1559 setFlags_Widget(winBar, hidden_WidgetFlag, d->place.snap == fullscreen_WindowSnap);
1560 if (newRect.size.x) { 1560 if (newRect.size.x) {
1561 SDL_SetWindowPosition(d->win, newRect.pos.x, newRect.pos.y); 1561 SDL_SetWindowPosition(d->base.win, newRect.pos.x, newRect.pos.y);
1562 SDL_SetWindowSize(d->win, newRect.size.x, newRect.size.y); 1562 SDL_SetWindowSize(d->base.win, newRect.size.x, newRect.size.y);
1563 postCommand_App("window.resized"); 1563 postCommand_App("window.resized");
1564 } 1564 }
1565 if (wasVisible != isVisible_Widget(winBar)) { 1565 if (wasVisible != isVisible_Widget(winBar)) {