Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
985f9df6
Commit
985f9df6
authored
Jul 14, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed setting fullscreen and maximized states for windows that haven't been mapped yet.
parent
fdac60bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
38 deletions
+81
-38
SDL_x11window.c
src/video/x11/SDL_x11window.c
+81
-38
No files found.
src/video/x11/SDL_x11window.c
View file @
985f9df6
...
...
@@ -43,10 +43,9 @@
#define _NET_WM_STATE_TOGGLE 2l
static
SDL_bool
X11_
WindowIsOldstyleFullscreen
(
SDL_Window
*
window
)
X11_
IsWindowOldFullscreen
(
_THIS
,
SDL_Window
*
window
)
{
SDL_WindowData
*
data
=
(
SDL_WindowData
*
)
window
->
driverdata
;
SDL_VideoData
*
videodata
=
(
SDL_VideoData
*
)
data
->
videodata
;
SDL_VideoData
*
videodata
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
if
((
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
&&
!
videodata
->
net_wm
)
{
...
...
@@ -56,6 +55,37 @@ X11_WindowIsOldstyleFullscreen(SDL_Window * window)
}
}
static
SDL_bool
X11_IsWindowMapped
(
_THIS
,
SDL_Window
*
window
)
{
SDL_WindowData
*
data
=
(
SDL_WindowData
*
)
window
->
driverdata
;
SDL_VideoData
*
videodata
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
XWindowAttributes
attr
;
XGetWindowAttributes
(
videodata
->
display
,
data
->
xwindow
,
&
attr
);
if
(
attr
.
map_state
!=
IsUnmapped
)
{
return
SDL_TRUE
;
}
else
{
return
SDL_FALSE
;
}
}
static
int
X11_GetWMStateProperty
(
_THIS
,
SDL_Window
*
window
,
Atom
atoms
[
3
])
{
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
int
count
=
0
;
if
(
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
{
atoms
[
count
++
]
=
data
->
_NET_WM_STATE_FULLSCREEN
;
}
if
(
window
->
flags
&
SDL_WINDOW_MAXIMIZED
)
{
atoms
[
count
++
]
=
data
->
_NET_WM_STATE_MAXIMIZED_VERT
;
atoms
[
count
++
]
=
data
->
_NET_WM_STATE_MAXIMIZED_HORZ
;
}
return
count
;
}
static
void
X11_GetDisplaySize
(
_THIS
,
SDL_Window
*
window
,
int
*
w
,
int
*
h
)
{
...
...
@@ -237,13 +267,11 @@ X11_CreateWindow(_THIS, SDL_Window * window)
SDL_bool
oldstyle_fullscreen
;
Atom
_NET_WM_WINDOW_TYPE
;
Atom
_NET_WM_WINDOW_TYPE_NORMAL
;
int
wmstate_count
;
Atom
wmstate_atoms
[
3
];
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
if
((
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
&&
!
data
->
net_wm
)
{
oldstyle_fullscreen
=
SDL_TRUE
;
}
else
{
oldstyle_fullscreen
=
SDL_FALSE
;
}
oldstyle_fullscreen
=
X11_IsWindowOldFullscreen
(
_this
,
window
);
#if SDL_VIDEO_DRIVER_X11_XINERAMA
/* FIXME
...
...
@@ -665,21 +693,14 @@ X11_CreateWindow(_THIS, SDL_Window * window)
XFree
(
classhints
);
}
/* FIXME: Why doesn't this work? */
if
(
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
{
Atom
_NET_WM_STATE
=
data
->
_NET_WM_STATE
;
Atom
_NET_WM_STATE_FULLSCREEN
=
data
->
_NET_WM_STATE_FULLSCREEN
;
XEvent
e
;
e
.
xany
.
type
=
ClientMessage
;
e
.
xclient
.
message_type
=
_NET_WM_STATE
;
e
.
xclient
.
format
=
32
;
e
.
xclient
.
data
.
l
[
0
]
=
_NET_WM_STATE_ADD
;
e
.
xclient
.
data
.
l
[
1
]
=
_NET_WM_STATE_FULLSCREEN
;
e
.
xclient
.
data
.
l
[
2
]
=
0l
;
XSendEvent
(
display
,
RootWindow
(
display
,
screen
),
0
,
SubstructureNotifyMask
|
SubstructureRedirectMask
,
&
e
);
/* Set the window manager state */
wmstate_count
=
X11_GetWMStateProperty
(
_this
,
window
,
wmstate_atoms
);
if
(
wmstate_count
>
0
)
{
XChangeProperty
(
display
,
w
,
data
->
_NET_WM_STATE
,
XA_ATOM
,
32
,
PropModeReplace
,
(
unsigned
char
*
)
wmstate_atoms
,
wmstate_count
);
}
else
{
XDeleteProperty
(
display
,
w
,
data
->
_NET_WM_STATE
);
}
/* Let the window manager know we're a "normal" window */
...
...
@@ -881,7 +902,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
int
x
,
y
;
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
oldstyle_fullscreen
=
X11_
WindowIsOldstyleFullscreen
(
window
);
oldstyle_fullscreen
=
X11_
IsWindowOldFullscreen
(
_this
,
window
);
if
(
oldstyle_fullscreen
||
window
->
x
==
SDL_WINDOWPOS_CENTERED
)
{
...
...
@@ -946,11 +967,15 @@ X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
Atom
_NET_WM_STATE
=
data
->
videodata
->
_NET_WM_STATE
;
Atom
_NET_WM_STATE_MAXIMIZED_VERT
=
data
->
videodata
->
_NET_WM_STATE_MAXIMIZED_VERT
;
Atom
_NET_WM_STATE_MAXIMIZED_HORZ
=
data
->
videodata
->
_NET_WM_STATE_MAXIMIZED_HORZ
;
Atom
_NET_WM_STATE_FULLSCREEN
=
data
->
videodata
->
_NET_WM_STATE_FULLSCREEN
;
if
(
X11_IsWindowMapped
(
_this
,
window
))
{
XEvent
e
;
e
.
xany
.
type
=
ClientMessage
;
e
.
xclient
.
message_type
=
_NET_WM_STATE
;
e
.
xclient
.
format
=
32
;
e
.
xclient
.
window
=
data
->
xwindow
;
e
.
xclient
.
data
.
l
[
0
]
=
maximized
?
_NET_WM_STATE_ADD
:
_NET_WM_STATE_REMOVE
;
e
.
xclient
.
data
.
l
[
1
]
=
_NET_WM_STATE_MAXIMIZED_VERT
;
...
...
@@ -959,6 +984,24 @@ X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
XSendEvent
(
display
,
RootWindow
(
display
,
displaydata
->
screen
),
0
,
SubstructureNotifyMask
|
SubstructureRedirectMask
,
&
e
);
}
else
{
int
count
=
0
;
Atom
atoms
[
3
];
if
(
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
{
atoms
[
count
++
]
=
_NET_WM_STATE_FULLSCREEN
;
}
if
(
maximized
)
{
atoms
[
count
++
]
=
_NET_WM_STATE_MAXIMIZED_VERT
;
atoms
[
count
++
]
=
_NET_WM_STATE_MAXIMIZED_HORZ
;
}
if
(
count
>
0
)
{
XChangeProperty
(
display
,
data
->
xwindow
,
_NET_WM_STATE
,
XA_ATOM
,
32
,
PropModeReplace
,
(
unsigned
char
*
)
atoms
,
count
);
}
else
{
XDeleteProperty
(
display
,
data
->
xwindow
,
_NET_WM_STATE
);
}
}
}
void
...
...
@@ -993,7 +1036,7 @@ X11_SetWindowGrab(_THIS, SDL_Window * window)
SDL_bool
oldstyle_fullscreen
;
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
oldstyle_fullscreen
=
X11_
WindowIsOldstyleFullscreen
(
window
);
oldstyle_fullscreen
=
X11_
IsWindowOldFullscreen
(
_this
,
window
);
if
(((
window
->
flags
&
SDL_WINDOW_INPUT_GRABBED
)
||
oldstyle_fullscreen
)
&&
(
window
->
flags
&
SDL_WINDOW_INPUT_FOCUS
))
{
...
...
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