Skip to content
Snippets Groups Projects
Commit 7ece180e authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix issue 146

Fix return value when handling WM_SETCURSOR.  Returning FALSE
indicating we didn't handle it stopped the cursor from being set
to the size arrow cursors.  Instead, pass it to DefWindowProc().

While we're here, handle WM_SIZING to make it more clear that you
can't change the aspect ratio by dragging.
parent c41c03ad
No related branches found
No related tags found
No related merge requests found
Pipeline #6734 passed
......@@ -131,3 +131,19 @@ http://viznut.fi/unscii/
Unifont... the mother of all fonts...
https://unifoundry.com/unifont/index.html
For Unicode, we're not going to want the fonts in the image I don't
think, so they'll need to be loaded from disk/rasterized on demand.
This means a cache that we can use bsearch() on... which means we'll
need something like an epoch to age things out of the cache, and the
cache will need to be cleared after each connection... and presumably
at certain other points during a connection. Getting this right with
epoch stuff is going to prove tricky, but be necessary to prevent
blocking while waiting to render a glyph (essentially, it must *always*
be possible to add a new glyph without blocking).
Further, "fonts" will need to have a source map as well... loading
a CP437 font will only update specific glyphs for example, and those
will be spread out around the space, so "stacks" of fonts, each
entry listing ranges to map will be needed, and we'll want to use
bsearch() there too.
......@@ -271,6 +271,51 @@ gdi_handle_wm_size(WPARAM wParam, LPARAM lParam)
return 0;
}
static LRESULT
gdi_handle_wm_sizing(WPARAM wParam, RECT *r)
{
int ow, oh, nw, nh;
double s;
RECT tr = *r;
ow = r->right - r->left;
oh = r->bottom - r->top;
UnadjustWindowSize(&ow, &oh);
nw = ow;
nh = oh;
pthread_mutex_lock(&vstatlock);
s = bitmap_double_mult_inside(ow, oh);
bitmap_get_scaled_win_size(s, &nw, &nh, 0, 0);
pthread_mutex_unlock(&vstatlock);
if (nw != ow) {
switch (wParam) {
case WMSZ_BOTTOMLEFT:
case WMSZ_LEFT:
case WMSZ_TOPLEFT:
r->left += (nw - ow);
break;
default:
r->right += (nw - ow);
break;
}
}
if (nh != oh) {
switch (wParam) {
case WMSZ_TOP:
case WMSZ_TOPLEFT:
case WMSZ_TOPRIGHT:
r->top += (nh - oh);
break;
default:
r->bottom += (nh - oh);
break;
}
}
return TRUE;
}
static LRESULT
gdi_handle_wm_paint(HWND hwnd)
{
......@@ -646,6 +691,8 @@ gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return 0;
case WM_SIZE:
return gdi_handle_wm_size(wParam, lParam);
case WM_SIZING:
return gdi_handle_wm_sizing(wParam, (RECT *)lParam);
case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
......@@ -675,7 +722,7 @@ gdi_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SetCursor(cursor);
return TRUE;
}
return FALSE;
break;
case WM_GETDPISCALEDSIZE:
return gdi_handle_getdpiscaledsize(HIWORD(wParam), (LPSIZE)lParam);
case WM_DPICHANGED:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment