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
764116ba
Commit
764116ba
authored
Jun 04, 2003
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/gui/skins/x11/x11_api.cpp: implemented OSAPI_GetTime() and OSAPI_RmDir().
parent
26ca5a34
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
54 deletions
+46
-54
modules/gui/skins/x11/x11_api.cpp
modules/gui/skins/x11/x11_api.cpp
+46
-54
No files found.
modules/gui/skins/x11/x11_api.cpp
View file @
764116ba
...
...
@@ -2,7 +2,7 @@
* x11_api.cpp: Various x11-specific functions
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_api.cpp,v 1.
5 2003/06/01 22:11:24 asmax
Exp $
* $Id: x11_api.cpp,v 1.
6 2003/06/04 17:44:57 gbazin
Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -37,30 +37,30 @@
#include "../os_api.h"
#include "../src/event.h" // for MAX_PARAM_SIZE
#include <sys/types.h>
#include <sys/stat.h> // stat()
#include <sys/time.h> // gettimeofday()
#include <dirent.h> // opendir() and friends
extern
intf_thread_t
*
g_pIntf
;
// ugly, but it's not my fault ;)
//---------------------------------------------------------------------------
// Event API
//---------------------------------------------------------------------------
void
OSAPI_SendMessage
(
SkinWindow
*
win
,
unsigned
int
message
,
unsigned
int
param1
,
long
param2
)
void
OSAPI_SendMessage
(
SkinWindow
*
win
,
unsigned
int
message
,
unsigned
int
param1
,
long
param2
)
{
/* if( win == NULL )
SendMessage( NULL, message, param1, param2 );
else
SendMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
param2 );*/
}
//---------------------------------------------------------------------------
void
OSAPI_PostMessage
(
SkinWindow
*
win
,
unsigned
int
message
,
unsigned
int
param1
,
long
param2
)
void
OSAPI_PostMessage
(
SkinWindow
*
win
,
unsigned
int
message
,
unsigned
int
param1
,
long
param2
)
{
XEvent
event
;
event
.
type
=
ClientMessage
;
event
.
xclient
.
display
=
g_pIntf
->
p_sys
->
display
;
event
.
xclient
.
send_event
=
0
;
event
.
xclient
.
message_type
=
NULL
;
event
.
xclient
.
message_type
=
0
;
event
.
xclient
.
format
=
32
;
event
.
xclient
.
data
.
l
[
0
]
=
message
;
event
.
xclient
.
data
.
l
[
1
]
=
param1
;
...
...
@@ -90,19 +90,7 @@ void OSAPI_PostMessage( SkinWindow *win, unsigned int message, unsigned int para
//---------------------------------------------------------------------------
int
OSAPI_GetNonTransparentColor
(
int
c
)
{
/* // Get desktop device context
HDC DeskDC = GetWindowDC( GetDesktopWindow() );
// If color is black or color is same as black wether pixel color depth
if( c == 0 || SetPixel( DeskDC, 0, 0, c ) == 0 )
{
if( GetDeviceCaps( DeskDC, BITSPIXEL ) < 24 )
c = RGB(8, 0, 0);
else
c = RGB(1, 0, 0);
}
ReleaseDC( GetDesktopWindow(), DeskDC );
return c;*/
return
0
;
}
//---------------------------------------------------------------------------
...
...
@@ -114,9 +102,9 @@ int OSAPI_GetNonTransparentColor( int c )
//---------------------------------------------------------------------------
int
OSAPI_GetTime
()
{
/* GTimeV
al time;
g
_get_current_time( &time
);
return
( time.tv_sec * 1000 + time.tv_usec / 1000 );*/
struct
timev
al
time
;
g
ettimeofday
(
&
time
,
NULL
);
return
(
time
.
tv_sec
*
1000
+
time
.
tv_usec
/
1000
);
}
//---------------------------------------------------------------------------
void
OSAPI_GetScreenSize
(
int
&
w
,
int
&
h
)
...
...
@@ -150,41 +138,45 @@ string OSAPI_GetWindowTitle( SkinWindow *win )
//---------------------------------------------------------------------------
bool
OSAPI_RmDir
(
string
path
)
{
/* WIN32_FIND_DATA find;
string File;
string FindFiles = path + "\\*.*";
HANDLE handle = FindFirstFile( (char *)FindFiles.c_str(), &find );
struct
dirent
*
file
;
DIR
*
dir
;
while( handle != INVALID_HANDLE_VALUE )
dir
=
opendir
(
path
.
c_str
()
);
if
(
!
dir
)
return
false
;
/* Parse the directory and remove everything it contains. */
while
(
(
file
=
readdir
(
dir
))
)
{
// If file is neither "." nor ".."
if( strcmp( find.cFileName, "." ) && strcmp( find.cFileName, ".." ) )
struct
stat
statbuf
;
string
filename
;
/* Skip "." and ".." */
if
(
!*
file
->
d_name
||
*
file
->
d_name
==
'.'
||
(
!*
(
file
->
d_name
+
1
)
&&
*
file
->
d_name
==
'.'
&&
*
(
file
->
d_name
+
1
)
==
'.'
)
)
{
// Set file name
File = path + "\\" + (string)find.cFileName;
continue
;
}
// If file is a directory, delete it recursively
if( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
filename
+=
path
+
"/"
;
filename
+=
file
->
d_name
;
if
(
!
stat
(
filename
.
c_str
(),
&
statbuf
)
&&
statbuf
.
st_mode
&
S_IFDIR
)
{
OSAPI_RmDir( Fil
e );
OSAPI_RmDir
(
filenam
e
);
}
// Else, it is a file so simply delete it
else
{
DeleteFile( (char *)Fil
e.c_str() );
unlink
(
filenam
e
.
c_str
()
);
}
}
// If no more file in directory, exit while
if( !FindNextFile( handle, &find ) )
break;
}
/* Close the directory */
closedir
(
dir
);
// Now directory is empty so can be removed
FindClose( handle );
RemoveDirectory( (char *)path.c_str() );
rmdir
(
path
.
c_str
()
);
return true;
*/
return
true
;
}
//---------------------------------------------------------------------------
...
...
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