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
c7c00fa3
Commit
c7c00fa3
authored
Jan 22, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XCB/GLX: reuse windowing code from other XCB plugins
parent
be23a60d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
82 deletions
+16
-82
modules/video_output/xcb/events.c
modules/video_output/xcb/events.c
+3
-3
modules/video_output/xcb/glx.c
modules/video_output/xcb/glx.c
+13
-78
modules/video_output/xcb/xcb_vlc.h
modules/video_output/xcb/xcb_vlc.h
+0
-1
No files found.
modules/video_output/xcb/events.c
View file @
c7c00fa3
...
...
@@ -85,8 +85,8 @@ static xcb_connection_t *Connect (vlc_object_t *obj, const char *display)
/**
* (Try to) register to mouse events on a window if needed.
*/
void
RegisterMouse
Events
(
vlc_object_t
*
obj
,
xcb_connection_t
*
conn
,
xcb_window_t
wnd
)
static
void
Register
Events
(
vlc_object_t
*
obj
,
xcb_connection_t
*
conn
,
xcb_window_t
wnd
)
{
/* Subscribe to parent window resize events */
uint32_t
value
=
XCB_EVENT_MASK_POINTER_MOTION
...
...
@@ -158,7 +158,7 @@ vout_window_t *GetWindow (vout_display_t *vd,
/* Events must be registered before the window geometry is queried, so as
* to avoid missing impeding resize events. */
Register
Mouse
Events
(
VLC_OBJECT
(
vd
),
conn
,
wnd
->
handle
.
xid
);
RegisterEvents
(
VLC_OBJECT
(
vd
),
conn
,
wnd
->
handle
.
xid
);
xcb_get_geometry_reply_t
*
geo
=
xcb_get_geometry_reply
(
conn
,
xcb_get_geometry
(
conn
,
wnd
->
handle
.
xid
),
...
...
modules/video_output/xcb/glx.c
View file @
c7c00fa3
...
...
@@ -84,70 +84,19 @@ static void Manage (vout_display_t *);
static
void
SwapBuffers
(
vlc_gl_t
*
gl
);
static
void
*
GetProcAddress
(
vlc_gl_t
*
gl
,
const
char
*
);
static
vout_window_t
*
MakeWindow
(
vout_display_t
*
vd
)
static
unsigned
GetScreenNumber
(
xcb_connection_t
*
conn
,
const
xcb_screen_t
*
screen
)
{
vout_window_cfg_t
wnd_cfg
;
memset
(
&
wnd_cfg
,
0
,
sizeof
(
wnd_cfg
));
wnd_cfg
.
type
=
VOUT_WINDOW_TYPE_XID
;
wnd_cfg
.
x
=
var_InheritInteger
(
vd
,
"video-x"
);
wnd_cfg
.
y
=
var_InheritInteger
(
vd
,
"video-y"
);
wnd_cfg
.
width
=
vd
->
cfg
->
display
.
width
;
wnd_cfg
.
height
=
vd
->
cfg
->
display
.
height
;
vout_window_t
*
wnd
=
vout_display_NewWindow
(
vd
,
&
wnd_cfg
);
if
(
wnd
==
NULL
)
msg_Err
(
vd
,
"parent window not available"
);
return
wnd
;
}
static
const
xcb_screen_t
*
FindWindow
(
vout_display_t
*
vd
,
xcb_connection_t
*
conn
,
unsigned
*
restrict
pnum
,
uint8_t
*
restrict
pdepth
,
uint16_t
*
restrict
pwidth
,
uint16_t
*
restrict
pheight
)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
xcb_get_geometry_reply_t
*
geo
=
xcb_get_geometry_reply
(
conn
,
xcb_get_geometry
(
conn
,
sys
->
embed
->
handle
.
xid
),
NULL
);
if
(
geo
==
NULL
)
{
msg_Err
(
vd
,
"parent window not valid"
);
return
NULL
;
}
xcb_window_t
root
=
geo
->
root
;
*
pdepth
=
geo
->
depth
;
*
pwidth
=
geo
->
width
;
*
pheight
=
geo
->
height
;
free
(
geo
);
/* Find the selected screen */
const
xcb_setup_t
*
setup
=
xcb_get_setup
(
conn
);
const
xcb_screen_t
*
screen
=
NULL
;
unsigned
num
=
0
;
for
(
xcb_screen_iterator_t
i
=
xcb_setup_roots_iterator
(
setup
);
i
.
rem
>
0
;
for
(
xcb_screen_iterator_t
i
=
xcb_setup_roots_iterator
(
setup
);;
xcb_screen_next
(
&
i
))
{
if
(
i
.
data
->
root
==
root
)
{
screen
=
i
.
data
;
break
;
}
if
(
i
.
data
->
root
==
screen
->
root
)
return
num
;
num
++
;
}
if
(
screen
==
NULL
)
{
msg_Err
(
vd
,
"parent window screen not found"
);
return
NULL
;
}
msg_Dbg
(
vd
,
"using screen 0x%"
PRIx32
" (number: %u)"
,
root
,
num
);
*
pnum
=
num
;
return
screen
;
}
static
bool
CheckGLX
(
vout_display_t
*
vd
,
Display
*
dpy
)
...
...
@@ -215,22 +164,20 @@ static int Open (vlc_object_t *obj)
sys
->
pool
=
NULL
;
sys
->
gl
.
sys
=
NULL
;
/* Get window */
sys
->
embed
=
MakeWindow
(
vd
);
/* Get window, connect to X server (via XCB) */
xcb_connection_t
*
conn
;
const
xcb_screen_t
*
scr
;
uint16_t
width
,
height
;
uint8_t
depth
;
sys
->
embed
=
GetWindow
(
vd
,
&
conn
,
&
scr
,
&
depth
,
&
width
,
&
height
);
if
(
sys
->
embed
==
NULL
)
{
free
(
sys
);
return
VLC_EGENERIC
;
}
const
unsigned
snum
=
GetScreenNumber
(
conn
,
scr
);
/* Connect to X server */
xcb_connection_t
*
conn
=
xcb_connect
(
sys
->
embed
->
display
.
x11
,
NULL
);
if
(
unlikely
(
xcb_connection_has_error
(
conn
)))
{
vout_display_DeleteWindow
(
vd
,
sys
->
embed
);
free
(
sys
);
return
VLC_EGENERIC
;
}
sys
->
conn
=
conn
;
Display
*
dpy
=
XOpenDisplay
(
sys
->
embed
->
display
.
x11
);
if
(
dpy
==
NULL
)
...
...
@@ -241,23 +188,11 @@ static int Open (vlc_object_t *obj)
return
VLC_EGENERIC
;
}
sys
->
display
=
dpy
;
sys
->
conn
=
conn
;
sys
->
ctx
=
NULL
;
if
(
!
CheckGLX
(
vd
,
dpy
))
goto
error
;
RegisterMouseEvents
(
obj
,
conn
,
sys
->
embed
->
handle
.
xid
);
/* Find window parameters */
unsigned
snum
;
uint8_t
depth
;
uint16_t
width
,
height
;
const
xcb_screen_t
*
scr
=
FindWindow
(
vd
,
conn
,
&
snum
,
&
depth
,
&
width
,
&
height
);
if
(
scr
==
NULL
)
goto
error
;
sys
->
window
=
xcb_generate_id
(
conn
);
/* Determine our pixel format */
...
...
modules/video_output/xcb/xcb_vlc.h
View file @
c7c00fa3
...
...
@@ -47,7 +47,6 @@ struct vout_window_t *GetWindow (vout_display_t *obj, xcb_connection_t **,
uint16_t
*
width
,
uint16_t
*
height
);
bool
CheckSHM
(
vlc_object_t
*
obj
,
xcb_connection_t
*
conn
);
xcb_cursor_t
CreateBlankCursor
(
xcb_connection_t
*
,
const
xcb_screen_t
*
);
void
RegisterMouseEvents
(
vlc_object_t
*
,
xcb_connection_t
*
,
xcb_window_t
);
int
CheckError
(
vout_display_t
*
,
xcb_connection_t
*
conn
,
const
char
*
str
,
xcb_void_cookie_t
);
...
...
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