Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
908acfe2
Commit
908acfe2
authored
Oct 12, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XCB/window: catch resize events
parent
787a60ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
14 deletions
+48
-14
modules/video_output/xcb/window.c
modules/video_output/xcb/window.c
+48
-14
No files found.
modules/video_output/xcb/window.c
View file @
908acfe2
...
...
@@ -247,7 +247,7 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
/* XCB_CW_BACK_PIXEL */
scr
->
black_pixel
,
/* XCB_CW_EVENT_MASK */
XCB_EVENT_MASK_KEY_PRESS
,
XCB_EVENT_MASK_KEY_PRESS
|
XCB_EVENT_MASK_STRUCTURE_NOTIFY
,
};
xcb_window_t
window
=
xcb_generate_id
(
conn
);
...
...
@@ -329,6 +329,15 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
/* Make the window visible */
xcb_map_window
(
conn
,
window
);
/* Get the initial mapped size (may differ from requested size) */
xcb_get_geometry_reply_t
*
geo
=
xcb_get_geometry_reply
(
conn
,
xcb_get_geometry
(
conn
,
window
),
NULL
);
if
(
geo
!=
NULL
)
{
vout_window_ReportSize
(
wnd
,
geo
->
width
,
geo
->
height
);
free
(
geo
);
}
/* Create the event thread. It will dequeue all events, so any checked
* request from this thread must be completed at this point. */
if
((
p_sys
->
keys
!=
NULL
)
...
...
@@ -368,6 +377,30 @@ static void Close (vout_window_t *wnd)
free
(
p_sys
);
}
static
void
ProcessEvent
(
vout_window_t
*
wnd
,
xcb_generic_event_t
*
ev
)
{
vout_window_sys_t
*
sys
=
wnd
->
sys
;
if
(
sys
->
keys
!=
NULL
&&
XCB_keyHandler_Process
(
sys
->
keys
,
ev
)
==
0
)
return
;
switch
(
ev
->
response_type
&
0x7f
)
{
case
XCB_CONFIGURE_NOTIFY
:
{
xcb_configure_notify_event_t
*
cne
=
(
void
*
)
ev
;
vout_window_ReportSize
(
wnd
,
cne
->
width
,
cne
->
height
);
break
;
}
case
XCB_MAPPING_NOTIFY
:
break
;
default:
msg_Dbg
(
wnd
,
"unhandled event %"
PRIu8
,
ev
->
response_type
);
}
free
(
ev
);
}
/** Background thread for X11 events handling */
static
void
*
Thread
(
void
*
data
)
...
...
@@ -389,12 +422,7 @@ static void *Thread (void *data)
int
canc
=
vlc_savecancel
();
while
((
ev
=
xcb_poll_for_event
(
conn
))
!=
NULL
)
{
if
(
XCB_keyHandler_Process
(
p_sys
->
keys
,
ev
)
==
0
)
continue
;
msg_Dbg
(
wnd
,
"unhandled event: %"
PRIu8
,
ev
->
response_type
);
free
(
ev
);
}
ProcessEvent
(
wnd
,
ev
);
vlc_restorecancel
(
canc
);
if
(
xcb_connection_has_error
(
conn
))
...
...
@@ -583,6 +611,12 @@ static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
p_sys
->
conn
=
conn
;
/* Subscribe to window events (_before_ the geometry is queried) */
uint32_t
mask
=
XCB_CW_EVENT_MASK
;
uint32_t
value
=
XCB_EVENT_MASK_STRUCTURE_NOTIFY
;
xcb_change_window_attributes
(
conn
,
window
,
mask
,
&
value
);
xcb_get_geometry_reply_t
*
geo
=
xcb_get_geometry_reply
(
conn
,
xcb_get_geometry
(
conn
,
window
),
NULL
);
if
(
geo
==
NULL
)
...
...
@@ -591,21 +625,21 @@ static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
goto
error
;
}
p_sys
->
root
=
geo
->
root
;
vout_window_ReportSize
(
wnd
,
geo
->
width
,
geo
->
height
);
free
(
geo
);
/* Try to subscribe to keyboard events (only one X11 client can
* subscribe to input events, so this can fail). */
if
(
var_InheritBool
(
wnd
,
"keyboard-events"
))
{
p_sys
->
keys
=
XCB_keyHandler_Create
(
VLC_OBJECT
(
wnd
),
conn
);
if
(
p_sys
->
keys
!=
NULL
)
{
const
uint32_t
mask
=
XCB_CW_EVENT_MASK
;
const
uint32_t
values
[
1
]
=
{
XCB_EVENT_MASK_KEY_PRESS
,
};
xcb_change_window_attributes
(
conn
,
window
,
mask
,
values
);
}
value
|=
XCB_EVENT_MASK_KEY_PRESS
;
}
if
(
value
&
~
XCB_EVENT_MASK_STRUCTURE_NOTIFY
)
xcb_change_window_attributes
(
conn
,
window
,
mask
,
&
value
);
CacheAtoms
(
p_sys
);
if
((
p_sys
->
keys
!=
NULL
)
&&
vlc_clone
(
&
p_sys
->
thread
,
Thread
,
wnd
,
VLC_THREAD_PRIORITY_LOW
))
...
...
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