Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
454
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
b79cadf8
Commit
b79cadf8
authored
15 years ago
by
Rémi Denis-Courmont
Browse files
Options
Downloads
Patches
Plain Diff
XCB Window: ugly hack to get focus with Matchbox window manager...
...and derivatives
parent
dbbe0df4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/video_output/xcb/window.c
+50
-2
50 additions, 2 deletions
modules/video_output/xcb/window.c
with
50 additions
and
2 deletions
modules/video_output/xcb/window.c
+
50
−
2
View file @
b79cadf8
...
...
@@ -90,6 +90,8 @@ vlc_module_end ()
static
int
Control
(
vout_window_t
*
,
int
,
va_list
ap
);
static
void
*
Thread
(
void
*
);
#define MATCHBOX_HACK 1
/* Matchbox focus hack */
struct
vout_window_sys_t
{
xcb_connection_t
*
conn
;
...
...
@@ -100,6 +102,9 @@ struct vout_window_sys_t
xcb_atom_t
wm_state
;
xcb_atom_t
wm_state_above
;
xcb_atom_t
wm_state_fullscreen
;
#ifdef MATCHBOX_HACK
xcb_atom_t
mb_current_app_window
;
#endif
};
/** Set an X window property from a nul-terminated string */
...
...
@@ -185,10 +190,17 @@ static void CacheAtoms (vout_window_sys_t *p_sys)
wm_state_ck
=
intern_string
(
conn
,
"_NET_WM_STATE"
);
wm_state_above_ck
=
intern_string
(
conn
,
"_NET_WM_STATE_ABOVE"
);
wm_state_fs_ck
=
intern_string
(
conn
,
"_NET_WM_STATE_FULLSCREEN"
);
#ifdef MATCHBOX_HACK
xcb_intern_atom_cookie_t
mb_current_app_window
;
mb_current_app_window
=
intern_string
(
conn
,
"_MB_CURRENT_APP_WINDOW"
);
#endif
p_sys
->
wm_state
=
get_atom
(
conn
,
wm_state_ck
);
p_sys
->
wm_state_above
=
get_atom
(
conn
,
wm_state_above_ck
);
p_sys
->
wm_state_fullscreen
=
get_atom
(
conn
,
wm_state_fs_ck
);
#ifdef MATCHBOX_HACK
p_sys
->
mb_current_app_window
=
get_atom
(
conn
,
mb_current_app_window
);
#endif
}
/**
...
...
@@ -302,6 +314,12 @@ static int Open (vlc_object_t *obj)
xcb_atom_t
wm_window_role
=
get_atom
(
conn
,
wm_window_role_ck
);
set_ascii_prop
(
conn
,
window
,
wm_window_role
,
"vlc-video"
);
#ifdef MATCHBOX_HACK
uint32_t
value
=
XCB_EVENT_MASK_PROPERTY_CHANGE
;
xcb_change_window_attributes
(
conn
,
scr
->
root
,
XCB_CW_EVENT_MASK
,
&
value
);
#endif
/* Make the window visible */
xcb_map_window
(
conn
,
window
);
...
...
@@ -314,8 +332,11 @@ static int Open (vlc_object_t *obj)
&&
vlc_clone
(
&
p_sys
->
thread
,
Thread
,
wnd
,
VLC_THREAD_PRIORITY_LOW
))
DestroyKeyHandler
(
p_sys
->
keys
);
#ifdef MATCHBOX_HACK
xcb_set_input_focus
(
p_sys
->
conn
,
XCB_INPUT_FOCUS_POINTER_ROOT
,
wnd
->
handle
.
xid
,
XCB_CURRENT_TIME
);
#endif
xcb_flush
(
conn
);
/* Make sure map_window is sent (should be useless) */
return
VLC_SUCCESS
;
error:
...
...
@@ -368,7 +389,34 @@ static void *Thread (void *data)
{
if
(
ProcessKeyEvent
(
p_sys
->
keys
,
ev
)
==
0
)
continue
;
msg_Dbg
(
wnd
,
"unhandled event: %"
PRIu8
,
ev
->
response_type
);
#ifdef MATCHBOX_HACK
if
((
ev
->
response_type
&
0x7f
)
==
XCB_PROPERTY_NOTIFY
)
{
const
xcb_property_notify_event_t
*
pne
=
(
xcb_property_notify_event_t
*
)
ev
;
if
(
pne
->
atom
==
p_sys
->
mb_current_app_window
&&
pne
->
state
==
XCB_PROPERTY_NEW_VALUE
)
{
xcb_get_property_reply_t
*
r
=
xcb_get_property_reply
(
conn
,
xcb_get_property
(
conn
,
0
,
pne
->
window
,
pne
->
atom
,
XA_WINDOW
,
0
,
4
),
NULL
);
if
(
r
!=
NULL
&&
!
memcmp
(
xcb_get_property_value
(
r
),
&
wnd
->
handle
.
xid
,
4
))
{
msg_Dbg
(
wnd
,
"asking Matchbox for input focus"
);
xcb_set_input_focus
(
conn
,
XCB_INPUT_FOCUS_POINTER_ROOT
,
wnd
->
handle
.
xid
,
pne
->
time
);
xcb_flush
(
conn
);
}
free
(
r
);
}
}
else
#endif
msg_Dbg
(
wnd
,
"unhandled event: %"
PRIu8
,
ev
->
response_type
);
free
(
ev
);
}
vlc_restorecancel
(
canc
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment