summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/prefs.c2
-rw-r--r--src/ui/window.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/prefs.c b/src/prefs.c
index 89e7f203..6af8f1d8 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -26,7 +26,7 @@ void init_Prefs(iPrefs *d) {
26 d->dialogTab = 0; 26 d->dialogTab = 0;
27 d->useSystemTheme = iTrue; 27 d->useSystemTheme = iTrue;
28 d->theme = dark_ColorTheme; 28 d->theme = dark_ColorTheme;
29 d->customFrame = iTrue; 29 d->customFrame = iFalse; /* needs some more work to be default */
30 d->retainWindowSize = iTrue; 30 d->retainWindowSize = iTrue;
31 d->uiScale = 1.0f; /* default set elsewhere */ 31 d->uiScale = 1.0f; /* default set elsewhere */
32 d->zoomPercent = 100; 32 d->zoomPercent = 100;
diff --git a/src/ui/window.c b/src/ui/window.c
index 998f5681..c5eb7e03 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -841,12 +841,12 @@ static SDL_HitTestResult hitTest_Window_(SDL_Window *win, const SDL_Point *pos,
841 if (isTop) { 841 if (isTop) {
842 return pos->x < captionHeight ? SDL_HITTEST_RESIZE_TOPLEFT 842 return pos->x < captionHeight ? SDL_HITTEST_RESIZE_TOPLEFT
843 : pos->x > w - captionHeight ? SDL_HITTEST_RESIZE_TOPRIGHT 843 : pos->x > w - captionHeight ? SDL_HITTEST_RESIZE_TOPRIGHT
844 : SDL_HITTEST_RESIZE_TOP; 844 : (d->place.lastHit = SDL_HITTEST_RESIZE_TOP);
845 } 845 }
846 if (isBottom) { 846 if (isBottom) {
847 return pos->x < captionHeight ? SDL_HITTEST_RESIZE_BOTTOMLEFT 847 return pos->x < captionHeight ? SDL_HITTEST_RESIZE_BOTTOMLEFT
848 : pos->x > w - captionHeight ? SDL_HITTEST_RESIZE_BOTTOMRIGHT 848 : pos->x > w - captionHeight ? SDL_HITTEST_RESIZE_BOTTOMRIGHT
849 : SDL_HITTEST_RESIZE_BOTTOM; 849 : (d->place.lastHit = SDL_HITTEST_RESIZE_BOTTOM);
850 } 850 }
851 } 851 }
852 if (pos->x < rightEdge && pos->y < captionHeight) { 852 if (pos->x < rightEdge && pos->y < captionHeight) {
@@ -1058,7 +1058,7 @@ static iBool unsnap_Window_(iWindow *d, const iInt2 *newPos) {
1058 if (snap_Window(d) == yMaximized_WindowSnap && newPos) { 1058 if (snap_Window(d) == yMaximized_WindowSnap && newPos) {
1059 d->place.normalRect.pos = *newPos; 1059 d->place.normalRect.pos = *newPos;
1060 } 1060 }
1061 printf("unsnap\n"); fflush(stdout); 1061 //printf("unsnap\n"); fflush(stdout);
1062 setSnap_Window(d, none_WindowSnap); 1062 setSnap_Window(d, none_WindowSnap);
1063 return iTrue; 1063 return iTrue;
1064 } 1064 }
@@ -1120,7 +1120,10 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
1120 return iTrue; 1120 return iTrue;
1121 } 1121 }
1122 if (iAbs(mouse.y - usable.y) < 2) { 1122 if (iAbs(mouse.y - usable.y) < 2) {
1123 setSnap_Window(d, redo_WindowSnap | maximized_WindowSnap); 1123 setSnap_Window(d,
1124 redo_WindowSnap | (d->place.lastHit == SDL_HITTEST_RESIZE_TOP
1125 ? yMaximized_WindowSnap
1126 : maximized_WindowSnap));
1124 return iTrue; 1127 return iTrue;
1125 } 1128 }
1126 } 1129 }
@@ -1448,7 +1451,8 @@ void setSnap_Window(iWindow *d, int snapMode) {
1448 d->place.snap = snapMode & ~redo_WindowSnap; 1451 d->place.snap = snapMode & ~redo_WindowSnap;
1449 switch (snapMode & mask_WindowSnap) { 1452 switch (snapMode & mask_WindowSnap) {
1450 case none_WindowSnap: 1453 case none_WindowSnap:
1451 newRect = d->place.normalRect; 1454 newRect = intersect_Rect(d->place.normalRect,
1455 init_Rect(usable.x, usable.y, usable.w, usable.h));
1452 break; 1456 break;
1453 case left_WindowSnap: 1457 case left_WindowSnap:
1454 newRect = init_Rect(usable.x, usable.y, usable.w / 2, usable.h); 1458 newRect = init_Rect(usable.x, usable.y, usable.w / 2, usable.h);