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
465
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
d47392b8
Commit
d47392b8
authored
21 years ago
by
Cyril Deguet
Browse files
Options
Downloads
Patches
Plain Diff
* beginning of event processing in X11 skins
* graphics should work, but....
parent
4e2943d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/gui/skins/x11/x11_run.cpp
+114
-19
114 additions, 19 deletions
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_window.cpp
+26
-21
26 additions, 21 deletions
modules/gui/skins/x11/x11_window.cpp
modules/gui/skins/x11/x11_window.h
+4
-3
4 additions, 3 deletions
modules/gui/skins/x11/x11_window.h
with
144 additions
and
43 deletions
modules/gui/skins/x11/x11_run.cpp
+
114
−
19
View file @
d47392b8
...
...
@@ -2,7 +2,7 @@
* x11_run.cpp:
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_run.cpp,v 1.
2
2003/05/1
2 17:33:19 gbazin
Exp $
* $Id: x11_run.cpp,v 1.
3
2003/05/1
3 20:36:29 asmax
Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -49,12 +49,6 @@
// include the icon graphic
#include
"share/vlc32x32.xpm"
//---------------------------------------------------------------------------
class
CallBackObjects
{
public:
VlcProc
*
Proc
;
};
//---------------------------------------------------------------------------
// Specific method
...
...
@@ -70,14 +64,13 @@ class Instance: public wxApp
{
public:
Instance
();
Instance
(
intf_thread_t
*
_p_intf
,
CallBackObjects
*
callback
);
Instance
(
intf_thread_t
*
_p_intf
);
bool
OnInit
();
OpenDialog
*
open
;
private:
intf_thread_t
*
p_intf
;
CallBackObjects
*
callbackobj
;
};
...
...
@@ -211,11 +204,10 @@ Instance::Instance( )
{
}
Instance
::
Instance
(
intf_thread_t
*
_p_intf
,
CallBackObjects
*
callback
)
Instance
::
Instance
(
intf_thread_t
*
_p_intf
)
{
// Initialization
p_intf
=
_p_intf
;
callbackobj
=
callback
;
}
IMPLEMENT_APP_NO_MAIN
(
Instance
)
...
...
@@ -241,18 +233,121 @@ bool Instance::OnInit()
//---------------------------------------------------------------------------
// GTK2 interface
// X11 event processing
//---------------------------------------------------------------------------
void
ProcessEvent
(
intf_thread_t
*
p_intf
,
VlcProc
*
proc
,
XEvent
*
event
)
{
// Variables
list
<
SkinWindow
*>::
const_iterator
win
;
unsigned
int
msg
;
Event
*
evt
;
Window
wnd
=
((
XAnyEvent
*
)
event
)
->
window
;
fprintf
(
stderr
,
"event %d %x
\n
"
,
event
->
type
,
wnd
);
// Create event to dispatch in windows
// Skin event
if
(
event
->
type
==
ClientMessage
)
{
/* msg = ( (GdkEventClient *)event )->data.l[0];
evt = (Event *)new OSEvent( p_intf,
((GdkEventAny *)event)->window,
msg,
( (GdkEventClient *)event )->data.l[1],
( (GdkEventClient *)event )->data.l[2] );*/
}
// System event
else
{
msg
=
event
->
type
;
evt
=
(
Event
*
)
new
OSEvent
(
p_intf
,
((
XAnyEvent
*
)
event
)
->
window
,
msg
,
0
,
(
long
)
event
);
}
// Process keyboard shortcuts
if
(
msg
==
KeyPress
)
{
/* int KeyModifier = 0;
// If key is ALT
if( ((GdkEventKey *)event)->state & GDK_MOD1_MASK )
{
KeyModifier = 1;
}
// If key is CTRL
else if( ((GdkEventKey *)event)->state & GDK_CONTROL_MASK )
{
KeyModifier = 2;
}
int key = ((GdkEventKey *)event)->keyval;
// Translate into lower case
if( key >= 'a' && key <= 'z' )
{
key -= ('a' - 'A');
}
if( KeyModifier > 0 )
p_intf->p_sys->p_theme->EvtBank->TestShortcut( key , KeyModifier );*/
}
// Send event
else
if
(
IsVLCEvent
(
msg
)
)
{
if
(
!
proc
->
EventProc
(
evt
)
)
{
// wxExit();
return
;
// Exit VLC !
}
}
else
if
(
wnd
==
NULL
)
{
for
(
win
=
p_intf
->
p_sys
->
p_theme
->
WindowList
.
begin
();
win
!=
p_intf
->
p_sys
->
p_theme
->
WindowList
.
end
();
win
++
)
{
(
*
win
)
->
ProcessEvent
(
evt
);
}
}
else
{
// Find window matching with gwnd
for
(
win
=
p_intf
->
p_sys
->
p_theme
->
WindowList
.
begin
();
win
!=
p_intf
->
p_sys
->
p_theme
->
WindowList
.
end
();
win
++
)
{
// If it is the correct window
if
(
wnd
==
(
(
X11Window
*
)(
*
win
)
)
->
GetHandle
()
)
{
// Send event and check if processed
if
(
(
*
win
)
->
ProcessEvent
(
evt
)
)
{
delete
(
OSEvent
*
)
evt
;
return
;
}
else
{
break
;
}
}
}
}
evt
->
DestructParameters
();
delete
(
OSEvent
*
)
evt
;
// Check if vlc is closing
proc
->
IsClosing
();
}
//---------------------------------------------------------------------------
// X11 interface
//---------------------------------------------------------------------------
void
OSRun
(
intf_thread_t
*
p_intf
)
{
static
char
*
p_args
[]
=
{
""
};
// Create VLC event object processing
CallBackObjects
*
callbackobj
=
new
CallBackObjects
();
callbackobj
->
Proc
=
new
VlcProc
(
p_intf
);
VlcProc
*
proc
=
new
VlcProc
(
p_intf
);
/* wxTheApp = new Instance( p_intf, callbackobj );
wxEntry( 1, p_args );*/
Display
*
display
=
((
OSTheme
*
)
p_intf
->
p_sys
->
p_theme
)
->
GetDisplay
();
...
...
@@ -262,10 +357,10 @@ void OSRun( intf_thread_t *p_intf )
{
XEvent
*
event
;
XNextEvent
(
display
,
event
);
fprintf
(
stderr
,
"event %d
\n
"
,
event
->
type
);
ProcessEvent
(
p_intf
,
proc
,
event
);
}
delete
callbackobj
;
}
//---------------------------------------------------------------------------
bool
IsVLCEvent
(
unsigned
int
msg
)
...
...
This diff is collapsed.
Click to expand it.
modules/gui/skins/x11/x11_window.cpp
+
26
−
21
View file @
d47392b8
...
...
@@ -2,7 +2,7 @@
* x11_window.cpp: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.cpp,v 1.
1
2003/0
4/28 14:32:57
asmax Exp $
* $Id: x11_window.cpp,v 1.
2
2003/0
5/13 20:36:29
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -58,7 +58,11 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
{
// Set handles
Wnd
=
wnd
;
// gc = gdk_gc_new( gwnd );
display
=
p_intf
->
p_sys
->
display
;
int
screen
=
DefaultScreen
(
display
);
Gc
=
DefaultGC
(
display
,
screen
);
Name
=
name
;
...
...
@@ -155,15 +159,15 @@ bool X11Window::ProcessOSEvent( Event *evt )
unsigned
int
msg
=
evt
->
GetMessage
();
unsigned
int
p1
=
evt
->
GetParam1
();
int
p2
=
evt
->
GetParam2
();
/*
switch
(
msg
)
{
case
GDK_EXPOSE
:
case
Expose
:
RefreshFromImage
(
0
,
0
,
Width
,
Height
);
return
true
;
case
GDK_MOTION_NOTIFY
:
if( LButtonDown )
case
MotionNotify
:
/*
if( LButtonDown )
MouseMove( (int)( (GdkEventButton *)p2 )->x,
(int)( (GdkEventButton *)p2 )->y, 1 );
else if( RButtonDown )
...
...
@@ -172,13 +176,13 @@ bool X11Window::ProcessOSEvent( Event *evt )
else
MouseMove( (int)( (GdkEventButton *)p2 )->x,
(int)( (GdkEventButton *)p2 )->y, 0 );
gdk_window_get_pointer( gWnd, 0, 0, 0 );
gdk_window_get_pointer( gWnd, 0, 0, 0 );
*/
return
true
;
case
GDK_BUTTON_PRESS
:
case
ButtonPress
:
// Raise all the windows
for( list<SkinWindow *>::const_iterator win =
/*
for( list<SkinWindow *>::const_iterator win =
p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
...
...
@@ -203,11 +207,11 @@ bool X11Window::ProcessOSEvent( Event *evt )
default:
break;
}
}
*/
return
true
;
case
GDK_BUTTON_RELEASE
:
switch( ( (GdkEventButton *)p2 )->button )
case
ButtonRelease
:
/*
switch( ( (GdkEventButton *)p2 )->button )
{
case 1:
// Left button
...
...
@@ -225,14 +229,14 @@ bool X11Window::ProcessOSEvent( Event *evt )
default:
break;
}
}
*/
return
true
;
case
GDK_LEAVE_NOTIFY
:
case
LeaveNotify
:
OSAPI_PostMessage
(
this
,
WINDOW_LEAVE
,
0
,
0
);
return
true
;
case GDK_2BUTTON_PRESS:
/*
case GDK_2BUTTON_PRESS:
MouseDblClick( (int)( (GdkEventButton *)p2 )->x,
(int)( (GdkEventButton *)p2 )->y, 1 );
return true;
...
...
@@ -256,10 +260,10 @@ bool X11Window::ProcessOSEvent( Event *evt )
break;
}
return true;
*/
default:
return
false
;
}
*/
}
}
//---------------------------------------------------------------------------
void
X11Window
::
SetTransparency
(
int
Value
)
...
...
@@ -283,11 +287,12 @@ void X11Window::RefreshFromImage( int x, int y, int w, int h )
ReleaseDC( hWnd, DC );
*/
/* GdkDrawable *drawable = (( X11Graphics* )Image )->GetImage();
GdkImage *image = gdk_drawable_get_image( drawable, 0, 0, Width, Height );
Drawable
drawable
=
((
X11Graphics
*
)
Image
)
->
GetImage
();
gdk_draw_drawable( gWnd, gc, drawable, x, y, x, y, w, h );
fprintf
(
stderr
,
"prout
\n
"
);
XCopyArea
(
display
,
drawable
,
Wnd
,
Gc
,
x
,
y
,
w
,
h
,
x
,
y
);
XSync
(
display
,
0
);
/*
// Mask for transparency
GdkRegion *region = gdk_region_new();
for( int line = 0; line < Height; line++ )
...
...
This diff is collapsed.
Click to expand it.
modules/gui/skins/x11/x11_window.h
+
4
−
3
View file @
d47392b8
...
...
@@ -2,7 +2,7 @@
* x11_window.h: X11 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_window.h,v 1.
1
2003/0
4/28 14:32:57
asmax Exp $
* $Id: x11_window.h,v 1.
2
2003/0
5/13 20:36:29
asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -39,7 +39,8 @@ class X11Window : public SkinWindow
private:
// General parameters
Window
Wnd
;
// GdkGC *gc;
Display
*
display
;
GC
Gc
;
int
CursorX
;
int
CursorY
;
int
WindowX
;
...
...
@@ -80,7 +81,7 @@ class X11Window : public SkinWindow
virtual
void
Move
(
int
left
,
int
top
);
virtual
void
Size
(
int
width
,
int
height
);
// Specific
gtk2
methods
// Specific
X11
methods
Window
GetHandle
()
{
return
Wnd
;
};
// Tooltip texts
...
...
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