gdkglcontext-win32.c: Fix running with Mesa drivers

Some GL drivers such as Mesa-D3D12 do not allow one to call SetPixelFormat() on
a given HDC if one pixel format has been already set for it, so first check the
HDC with GetPixelFormat() to see whether a pixel format has already been set
with the HDC, and only attempt to acquire the pixel format if one has not been
set.

This will fix running with GL/NGL on Windows using the Mesa drivers.
12 jobs for mesa.win32.fixes in 51 minutes and 2 seconds (queued for 1 second)
Status Job ID Name Coverage
  .Pre
failed #1273196
allowed to fail
style-check-diff

00:01:15

 
  Build
passed #1273197
fedora-x86_64

00:26:15

passed #1273199
installed-tests

00:23:30

passed #1273201
macos
macos

00:11:51

passed #1273200
win32-ps
msys2-mingw64

00:08:07

passed #1273198
release-build

00:03:29

 
  Analysis
failed #1273203
asan allowed to fail
asan-build

00:20:13

passed #1273202
static-scan

00:51:00

 
  Docs
passed #1273204
reference

00:22:11

 
  Flatpak
manual #1273205
flatpak allowed to fail manual
flatpak-manual:demo
manual #1273207
flatpak allowed to fail manual
flatpak-manual:icon-browser
manual #1273206
flatpak allowed to fail manual
flatpak-manual:widget-factory
 
Name Stage Failure
failed
style-check-diff .Pre
-  GDK_NOTE (OPENGL, g_print ("%s""requested and set pixel format: %d\n", already_checked ? "already " : "", *best_idx));
+ GDK_NOTE (OPENGL, g_print ("%s"
+ "requested and set pixel format: %d\n",
+ already_checked ? "already " : "", *best_idx));

return TRUE;
}
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
asan-build Analysis
 - css: 214 total, 214 pass, 0 fail
Processing gtk suite a11y:
- a11y: 22 total, 22 pass, 0 fail
Processing gtk suite tools:
- tools: 4 total, 3 pass, 1 fail
Processing gtk suite reftest:
- reftest: 132 total, 132 pass, 0 fail
Cleaning up file based variables
ERROR: Job failed: exit code 1