Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
87e3cd66
Commit
87e3cd66
authored
Sep 19, 2007
by
Chris Robinson
Committed by
Alexandre Julliard
Sep 20, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wgl: Don't set a pixel format on windows that already have one.
parent
f8f07dfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
opengl.c
dlls/opengl32/tests/opengl.c
+15
-2
opengl.c
dlls/winex11.drv/opengl.c
+8
-5
No files found.
dlls/opengl32/tests/opengl.c
View file @
87e3cd66
...
...
@@ -176,10 +176,12 @@ static void test_pbuffers(HDC hdc)
else
skip
(
"Pbuffer test for offscreen pixelformat skipped as no offscreen-only format with pbuffer capabilities has been found
\n
"
);
}
static
void
test_setpixelformat
(
void
)
static
void
test_setpixelformat
(
HDC
winhdc
)
{
int
res
=
0
;
int
nCfgs
;
int
pf
;
int
i
;
PIXELFORMATDESCRIPTOR
pfd
=
{
sizeof
(
PIXELFORMATDESCRIPTOR
),
1
,
/* version */
...
...
@@ -211,6 +213,17 @@ static void test_setpixelformat(void)
/* SetPixelFormat on the main device context 'X root window' should fail */
res
=
SetPixelFormat
(
hdc
,
pf
,
&
pfd
);
ok
(
res
==
0
,
"SetPixelFormat on main device context should fail
\n
"
);
/* Setting the same format that was set on the HDC is allowed; other
formats fail */
nCfgs
=
DescribePixelFormat
(
winhdc
,
0
,
0
,
NULL
);
pf
=
GetPixelFormat
(
winhdc
);
for
(
i
=
1
;
i
<=
nCfgs
;
i
++
)
{
int
res
=
SetPixelFormat
(
winhdc
,
i
,
NULL
);
if
(
i
==
pf
)
ok
(
res
,
"Failed to set the same pixel format
\n
"
);
else
ok
(
!
res
,
"Unexpectedly set an alternate pixel format
\n
"
);
}
}
static
void
test_colorbits
(
HDC
hdc
)
...
...
@@ -366,7 +379,7 @@ START_TEST(opengl)
ok
(
res
,
"wglMakeCurrent failed!
\n
"
);
init_functions
();
test_setpixelformat
();
test_setpixelformat
(
hdc
);
test_colorbits
(
hdc
);
test_gdi_dbuf
(
hdc
);
...
...
dlls/winex11.drv/opengl.c
View file @
87e3cd66
...
...
@@ -1369,35 +1369,38 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
if
(
!
has_opengl
())
{
ERR
(
"No libGL on this box - disabling OpenGL support !
\n
"
);
return
0
;
return
FALSE
;
}
/* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */
if
(
get_glxdrawable
(
physDev
)
==
root_window
)
{
ERR
(
"Invalid operation on root_window
\n
"
);
return
0
;
return
FALSE
;
}
/* Check if iPixelFormat is in our list of supported formats to see if it is supported. */
fmt
=
ConvertPixelFormatWGLtoGLX
(
gdi_display
,
iPixelFormat
,
FALSE
/* Offscreen */
,
&
value
);
if
(
!
fmt
)
{
ERR
(
"Invalid iPixelFormat: %d
\n
"
,
iPixelFormat
);
return
0
;
return
FALSE
;
}
if
(
physDev
->
current_pf
)
/* cannot change it if already set */
return
(
physDev
->
current_pf
==
iPixelFormat
);
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_DRAWABLE_TYPE
,
&
value
);
hwnd
=
WindowFromDC
(
physDev
->
hdc
);
if
(
hwnd
)
{
if
(
!
(
value
&
GLX_WINDOW_BIT
))
{
WARN
(
"Pixel format %d is not compatible for window rendering
\n
"
,
iPixelFormat
);
return
0
;
return
FALSE
;
}
if
(
!
SendMessageW
(
hwnd
,
WM_X11DRV_SET_WIN_FORMAT
,
(
WPARAM
)
fmt
->
fmt_id
,
0
))
{
ERR
(
"Couldn't set format of the window, returning failure
\n
"
);
return
0
;
return
FALSE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment