|
Lines 33-38
Link Here
|
| 33 |
#include <tdeio/netaccess.h> |
33 |
#include <tdeio/netaccess.h> |
| 34 |
#include <ktar.h> |
34 |
#include <ktar.h> |
| 35 |
|
35 |
|
|
|
36 |
#include "../../krdb/krdb.h" |
| 37 |
|
| 36 |
#include <tqlayout.h> |
38 |
#include <tqlayout.h> |
| 37 |
#include <tqdir.h> |
39 |
#include <tqdir.h> |
| 38 |
#include <tqpixmap.h> |
40 |
#include <tqpixmap.h> |
|
Lines 42-47
Link Here
|
| 42 |
#include <tqpainter.h> |
44 |
#include <tqpainter.h> |
| 43 |
#include <tqfileinfo.h> |
45 |
#include <tqfileinfo.h> |
| 44 |
#include <tqpushbutton.h> |
46 |
#include <tqpushbutton.h> |
|
|
47 |
#include <dcopref.h> |
| 45 |
|
48 |
|
| 46 |
#include <cstdlib> // for getenv() |
49 |
#include <cstdlib> // for getenv() |
| 47 |
|
50 |
|
|
Lines 53-58
Link Here
|
| 53 |
#include <X11/Xlib.h> |
56 |
#include <X11/Xlib.h> |
| 54 |
#include <X11/Xcursor/Xcursor.h> |
57 |
#include <X11/Xcursor/Xcursor.h> |
| 55 |
|
58 |
|
|
|
59 |
#ifdef HAVE_XFIXES |
| 60 |
# include <X11/extensions/Xfixes.h> |
| 61 |
#endif |
| 62 |
|
| 56 |
// Check for older version |
63 |
// Check for older version |
| 57 |
#if !defined(XCURSOR_LIB_MAJOR) && defined(XCURSOR_MAJOR) |
64 |
#if !defined(XCURSOR_LIB_MAJOR) && defined(XCURSOR_MAJOR) |
| 58 |
# define XCURSOR_LIB_MAJOR XCURSOR_MAJOR |
65 |
# define XCURSOR_LIB_MAJOR XCURSOR_MAJOR |
|
Lines 133-138
Link Here
|
| 133 |
{ |
140 |
{ |
| 134 |
} |
141 |
} |
| 135 |
|
142 |
|
|
|
143 |
bool ThemePage::applyTheme(TQString theme, TQString size) |
| 144 |
{ |
| 145 |
#ifdef HAVE_XCURSOR |
| 146 |
if (theme.isEmpty()) { |
| 147 |
return false; |
| 148 |
} |
| 149 |
|
| 150 |
// Apply the TDE cursor theme to ourselves |
| 151 |
XcursorSetTheme(tqt_xdisplay(), theme.latin1()); |
| 152 |
|
| 153 |
// Tell tdelauncher to set the XCURSOR_THEME and XCURSOR_SIZE environment |
| 154 |
// variables when launching applications. |
| 155 |
DCOPRef tdelauncher("tdelauncher"); |
| 156 |
tdelauncher.send("setLaunchEnv", TQCString("XCURSOR_THEME"), TQFile::encodeName(theme)); |
| 157 |
if( !size.isEmpty()) { |
| 158 |
tdelauncher.send("setLaunchEnv", TQCString("XCURSOR_SIZE"), size); |
| 159 |
} |
| 160 |
|
| 161 |
// Update the Xcursor X resources |
| 162 |
runRdb(0); |
| 163 |
|
| 164 |
// Apply the TDE cursor size to ourselves |
| 165 |
if (!size.isEmpty()) { |
| 166 |
XcursorSetDefaultSize(tqt_xdisplay(), size.toUInt()); |
| 167 |
} |
| 168 |
|
| 169 |
// Reload the standard cursors |
| 170 |
TQStringList names; |
| 171 |
|
| 172 |
// Qt cursors |
| 173 |
names << "left_ptr" << "up_arrow" << "cross" << "wait" |
| 174 |
<< "left_ptr_watch" << "ibeam" << "size_ver" << "size_hor" |
| 175 |
<< "size_bdiag" << "size_fdiag" << "size_all" << "split_v" |
| 176 |
<< "split_h" << "pointing_hand" << "openhand" |
| 177 |
<< "closedhand" << "forbidden" << "whats_this" << "copy" << "move" << "link"; |
| 178 |
|
| 179 |
// X core cursors |
| 180 |
names << "X_cursor" << "right_ptr" << "hand1" |
| 181 |
<< "hand2" << "watch" << "xterm" |
| 182 |
<< "crosshair" << "left_ptr_watch" << "center_ptr" |
| 183 |
<< "sb_h_double_arrow" << "sb_v_double_arrow" << "fleur" |
| 184 |
<< "top_left_corner" << "top_side" << "top_right_corner" |
| 185 |
<< "right_side" << "bottom_right_corner" << "bottom_side" |
| 186 |
<< "bottom_left_corner" << "left_side" << "question_arrow" |
| 187 |
<< "pirate"; |
| 188 |
|
| 189 |
for (int i = 0; i < names.size(); ++i) |
| 190 |
{ |
| 191 |
const char* name = (*(names.at(i))).ascii(); |
| 192 |
Cursor handle = XcursorLibraryLoadCursor(tqt_xdisplay(), name); |
| 193 |
XFixesChangeCursorByName(tqt_xdisplay(), handle, TQFile::encodeName(name)); |
| 194 |
XFreeCursor(tqt_xdisplay(), handle); // Don't leak the cursor |
| 195 |
} |
| 196 |
|
| 197 |
return true; |
| 198 |
#else // HAVE_XCURSOR |
| 199 |
return false; |
| 200 |
#endif |
| 201 |
} |
| 136 |
|
202 |
|
| 137 |
void ThemePage::save() |
203 |
void ThemePage::save() |
| 138 |
{ |
204 |
{ |
|
Lines 145-154
Link Here
|
| 145 |
c.setGroup( "Mouse" ); |
209 |
c.setGroup( "Mouse" ); |
| 146 |
c.writeEntry( "cursorTheme", selectedTheme != "system" ? selectedTheme : TQString::null ); |
210 |
c.writeEntry( "cursorTheme", selectedTheme != "system" ? selectedTheme : TQString::null ); |
| 147 |
|
211 |
|
| 148 |
KMessageBox::information( this, i18n("You have to restart TDE for these " |
212 |
// The Kcontrol panel does not allow to set cursor size for now. |
|
|
213 |
// So we keep the same size as written in config file. |
| 214 |
TQCString size = c.readEntry("cursorSize", TQString()).local8Bit(); |
| 215 |
|
| 216 |
if (!applyTheme(selectedTheme, size)) |
| 217 |
{ |
| 218 |
KMessageBox::information( this, i18n("You have to restart TDE for these " |
| 149 |
"changes to take effect."), i18n("Cursor Settings Changed"), |
219 |
"changes to take effect."), i18n("Cursor Settings Changed"), |
| 150 |
"CursorSettingsChanged" ); |
220 |
"CursorSettingsChanged" ); |
| 151 |
|
221 |
} |
|
|
222 |
|
| 152 |
currentTheme = selectedTheme; |
223 |
currentTheme = selectedTheme; |
| 153 |
} |
224 |
} |
| 154 |
|
225 |
|