4
* Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
5
* Copyright (c) 2005 Lubos Lunak <l.lunak@kde.org>
7
* Requires the Qt widget libraries, available at no cost at
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#include <config-X11.h>
33
# include <X11/Xcursor/Xcursor.h>
37
Display* QX11Info::display() { return dpy; }
38
Qt::HANDLE QX11Info::appRootWindow(int) { return DefaultRootWindow( dpy ); }
40
static bool isEmpty( const char* str )
44
while( isspace( *str ))
49
int main( int argc, char* argv[] )
53
dpy = XOpenDisplay( NULL );
58
const char* theme = argv[ 1 ];
59
const char* size = argv[ 2 ];
61
// Note: If you update this code, update kapplymousetheme as well.
63
// use a default value for theme only if it's not configured at all, not even in X resources
65
&& isEmpty( XGetDefault( QX11Info::display(), "Xcursor", "theme" ))
66
&& isEmpty( XcursorGetTheme( QX11Info::display())))
69
ret = 10; // means to switch to default
72
// Apply the KDE cursor theme to ourselves
73
if( !isEmpty( theme ))
74
XcursorSetTheme(QX11Info::display(), theme );
77
XcursorSetDefaultSize(QX11Info::display(), atoi( size ));
79
// Load the default cursor from the theme and apply it to the root window.
80
Cursor handle = XcursorLibraryLoadCursor(QX11Info::display(), "left_ptr");
81
XDefineCursor(QX11Info::display(), QX11Info::appRootWindow(), handle);
82
XFreeCursor(QX11Info::display(), handle); // Don't leak the cursor
85
( void ) QX11Info::display();
86
( void ) QX11Info::appRootWindow();