Merge branch 'lb90/for-main' into 'main'

GdkWin32 updates

Closes #6685 and #7147

See merge request GNOME/gtk!7931
This commit is contained in:
Matthias Clasen 2024-11-21 15:45:22 +00:00
commit b541435d46
3 changed files with 28 additions and 6 deletions

View File

@ -2270,6 +2270,26 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
BITMAPV5HEADER *bV5;
guchar *p;
guint i;
guint palette_number_of_colors = 0;
/* Image has a palette if format is BI_RGB (0) and
* bits per pixel is between 1 and 8.
* If the image has a palette,
* number of colors in the palette is either bi->biClrUsed,
* or if that is zero, use 1 << bi->biBitCount instead.
*/
if (bi->biCompression == BI_RGB &&
bi->biBitCount >= 1 &&
bi->biBitCount <= 8 &&
bi->biClrUsed >= 0 &&
bi->biClrUsed <= 256)
{
palette_number_of_colors = bi->biClrUsed;
if (palette_number_of_colors == 0)
{
palette_number_of_colors = 1 << bi->biBitCount;
}
}
if (bi->biSize == sizeof (BITMAPINFOHEADER) &&
bi->biPlanes == 1 &&
@ -2330,7 +2350,7 @@ transmute_cf_dib_to_image_bmp (const guchar *data,
{
bf->bfOffBits = (sizeof (BITMAPFILEHEADER) +
bi->biSize +
bi->biClrUsed * sizeof (RGBQUAD));
palette_number_of_colors * sizeof (RGBQUAD));
if (bi->biCompression == BI_BITFIELDS && bi->biBitCount >= 16)
{

View File

@ -1365,11 +1365,8 @@ modal_timer_proc (HWND hwnd,
DWORD time)
{
int arbitrary_limit = 10;
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_surface_get_display (GDK_SURFACE (id)));
while (display->display_surface_record->modal_operation_in_progress != GDK_WIN32_MODAL_OP_NONE &&
g_main_context_pending (NULL) &&
arbitrary_limit--)
while (g_main_context_pending (NULL) && arbitrary_limit--)
g_main_context_iteration (NULL, FALSE);
}

View File

@ -52,5 +52,10 @@ BOOL
gdk_win32_private_wglMakeCurrent (HDC hdc,
HGLRC hglrc)
{
return wglMakeCurrent (hdc, hglrc);
BOOL ret = wglMakeCurrent (hdc, hglrc);
void epoxy_handle_external_wglMakeCurrent (void);
epoxy_handle_external_wglMakeCurrent ();
return ret;
}