View | Details | Raw Unified | Return to bug 385149
Collapse All | Expand All

(-)a/kdebase-3.5.9/kcontrol/randr/legacyrandrscreen.cpp (+45 lines)
Lines 30-35 Link Here
30
#include <kiconloader.h>
30
#include <kiconloader.h>
31
#include <qlabel.h>
31
#include <qlabel.h>
32
#include <qdesktopwidget.h>
32
#include <qdesktopwidget.h>
33
#include <kprocess.h>
34
#include <kstandarddirs.h>
33
35
34
#include "ktimerdialog.h"
36
#include "ktimerdialog.h"
35
#include "legacyrandrscreen.h"
37
#include "legacyrandrscreen.h"
Lines 103-114 bool LegacyRandRScreen::applyProposed() Link Here
103
		m_currentSize = m_proposedSize;
105
		m_currentSize = m_proposedSize;
104
		m_currentRotation = m_proposedRotation;
106
		m_currentRotation = m_proposedRotation;
105
		m_currentRefreshRate = m_proposedRefreshRate;
107
		m_currentRefreshRate = m_proposedRefreshRate;
108
109
		// search wacom utility and set orientation for available wacom pointers
110
		QString xsetwacom = KStandardDirs::findExe("xsetwacom");
111
		if (!xsetwacom.isEmpty()) {
112
			m_wacomPointers.clear();
113
			KProcess *proc = new KProcess;
114
			connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(gotAvailablePointers(KProcess *, char *, int)));
115
                        *proc << "xsetwacom" << "list";
116
			if (!proc->start(KProcess::Block,KProcess::Stdout))
117
				kdError("Could not ask xsetwacom for available pointers.");
118
                        else {
119
				for ( QStringList::Iterator it = m_wacomPointers.begin(); it != m_wacomPointers.end(); ++it ) {
120
					KProcess *set = new KProcess;
121
					*set << "xsetwacom" << "set" << (*it) << "Rotate";
122
					switch (m_currentRotation) {
123
						case RR_Rotate_90:
124
							*set << "CW";
125
							break;
126
						case RR_Rotate_180:
127
							*set << "HALF";
128
							break;
129
						case RR_Rotate_270:
130
							*set << "CCW";
131
							break;
132
						default:
133
							*set << "NONE";
134
				        }
135
					if (!set->start())
136
						kdError("Could not set orientation for wacom pointers.");
137
				}
138
			}
139
		}
140
106
		return true;
141
		return true;
107
	}
142
	}
108
143
109
	return false;
144
	return false;
110
}
145
}
111
146
147
void LegacyRandRScreen::gotAvailablePointers(KProcess*, char *buffer, int len)
148
{
149
    QString myBuf = QString::fromLatin1(buffer, len);
150
    QStringList lines = QStringList::split('\n', myBuf);
151
    for ( QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
152
	QStringList split = QStringList::split(' ', (*it));
153
	m_wacomPointers+=split.first();
154
    }
155
}
156
112
bool LegacyRandRScreen::applyProposedAndConfirm()
157
bool LegacyRandRScreen::applyProposedAndConfirm()
113
{
158
{
114
	if (proposedChanged()) {
159
	if (proposedChanged()) {
(-)a/kdebase-3.5.9/kcontrol/randr/legacyrandrscreen.h (+6 lines)
Lines 30-35 Link Here
30
#include "randr.h"
30
#include "randr.h"
31
31
32
class KTimerDialog;
32
class KTimerDialog;
33
class KProcess;
33
34
34
class LegacyRandRScreen : public QObject
35
class LegacyRandRScreen : public QObject
35
{
36
{
Lines 135-140 public: Link Here
135
	void		load(KConfig& config);
136
	void		load(KConfig& config);
136
	void		save(KConfig& config) const;
137
	void		save(KConfig& config) const;
137
138
139
private slots:
140
	void 		gotAvailablePointers(KProcess*, char *buffer, int len);
141
138
private:
142
private:
139
	XRRScreenConfiguration*	m_config;
143
	XRRScreenConfiguration*	m_config;
140
144
Lines 156-161 private: Link Here
156
	int			m_proposedSize;
160
	int			m_proposedSize;
157
	int			m_proposedRefreshRate;
161
	int			m_proposedRefreshRate;
158
162
163
	QStringList		m_wacomPointers;
164
159
	KTimerDialog*	m_shownDialog;
165
	KTimerDialog*	m_shownDialog;
160
166
161
};
167
};
(-)a/kdebase-3.5.9/kcontrol/randr/randrscreen.cpp (+46 lines)
Lines 18-23 Link Here
18
18
19
#include <kdebug.h>
19
#include <kdebug.h>
20
#include <kconfig.h>
20
#include <kconfig.h>
21
#include <kprocess.h>
22
#include <kstandarddirs.h>
21
#include "randrscreen.h"
23
#include "randrscreen.h"
22
#include "randrcrtc.h"
24
#include "randrcrtc.h"
23
#include "randroutput.h"
25
#include "randroutput.h"
Lines 429-434 bool RandRScreen::applyProposed(bool confirm) Link Here
429
	if (succeed && confirm)
431
	if (succeed && confirm)
430
		succeed = RandR::confirm(r);
432
		succeed = RandR::confirm(r);
431
433
434
        if (succeed) {
435
               // search wacom utility and set orientation for available wacom pointers
436
               QString xsetwacom = KStandardDirs::findExe("xsetwacom");
437
               if (!xsetwacom.isEmpty()) {
438
                       m_wacomPointers.clear();
439
                       KProcess *proc = new KProcess;
440
                       connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(gotAvailablePointers(KProcess *, char *, int)));
441
                        *proc << "xsetwacom" << "list";
442
                       if (!proc->start(KProcess::Block,KProcess::Stdout))
443
                               kdError("Could not ask xsetwacom for available pointers.");
444
                        else {
445
                               for ( QStringList::Iterator it = m_wacomPointers.begin(); it != m_wacomPointers.end(); ++it ) {
446
                                       KProcess *set = new KProcess;
447
                                       *set << "xsetwacom" << "set" << (*it) << "Rotate";
448
                                       switch (m_unifiedRotation) {
449
                                               case RR_Rotate_90:
450
                                                       *set << "CW";
451
                                                       break;
452
                                               case RR_Rotate_180:
453
                                                       *set << "HALF";
454
                                                       break;
455
                                               case RR_Rotate_270:
456
                                                       *set << "CCW";
457
                                                       break;
458
                                               default:
459
                                                       *set << "NONE";
460
                                       }
461
                                       if (!set->start())
462
                                               kdError("Could not set orientation for wacom pointers.");
463
                               }
464
                       }
465
               }
466
        }
467
432
	// if we succeded applying and the user confirmer the changes,
468
	// if we succeded applying and the user confirmer the changes,
433
	// just return from here
469
	// just return from here
434
	if (succeed)
470
	if (succeed)
Lines 447-452 bool RandRScreen::applyProposed(bool confirm) Link Here
447
	return false;
483
	return false;
448
}
484
}
449
485
486
void RandRScreen::gotAvailablePointers(KProcess*, char *buffer, int len)
487
{
488
    QString myBuf = QString::fromLatin1(buffer, len);
489
    QStringList lines = QStringList::split('\n', myBuf);
490
    for ( QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
491
       QStringList split = QStringList::split(' ', (*it));
492
       m_wacomPointers+=split.first();
493
    }
494
}
495
450
void RandRScreen::unifyOutputs()
496
void RandRScreen::unifyOutputs()
451
{
497
{
452
	SizeList sizes = unifiedSizes();
498
	SizeList sizes = unifiedSizes();
(-)a/kdebase-3.5.9/kcontrol/randr/randrscreen.h (-1 / +5 lines)
Lines 29-34 Link Here
29
29
30
class QAction;
30
class QAction;
31
class KConfig;
31
class KConfig;
32
class KProcess;
32
33
33
class RandRScreen : public QObject
34
class RandRScreen : public QObject
34
{
35
{
Lines 95-100 public slots: Link Here
95
	void save();
96
	void save();
96
	void load();
97
	void load();
97
98
99
private slots:
100
        void gotAvailablePointers(KProcess*, char *buffer, int len);
101
98
signals:
102
signals:
99
	void configChanged();
103
	void configChanged();
100
104
Lines 119-125 private: Link Here
119
	CrtcMap m_crtcs;
123
	CrtcMap m_crtcs;
120
	OutputMap m_outputs;
124
	OutputMap m_outputs;
121
	ModeMap m_modes;
125
	ModeMap m_modes;
122
		
126
        QStringList m_wacomPointers;
123
};
127
};
124
#endif
128
#endif
125
129
(-)kcontrol/randr/randrcrtc.cpp (+44 lines)
Lines 17-22 Link Here
17
 */
17
 */
18
18
19
#include <kdebug.h>
19
#include <kdebug.h>
20
#include <kprocess.h>
21
#include <kstandarddirs.h>
20
#include "randrcrtc.h"
22
#include "randrcrtc.h"
21
#include "randrscreen.h"
23
#include "randrscreen.h"
22
#include "randroutput.h"
24
#include "randroutput.h"
Lines 298-303 Link Here
298
		m_currentRate = mode.refreshRate();
300
		m_currentRate = mode.refreshRate();
299
		emit crtcChanged(m_id, RandR::ChangeMode);
301
		emit crtcChanged(m_id, RandR::ChangeMode);
300
		ret = true;
302
		ret = true;
303
304
		// search wacom utility and set orientation for available wacom pointers
305
               QString xsetwacom = KStandardDirs::findExe("xsetwacom");
306
               if (!xsetwacom.isEmpty()) {
307
                       m_wacomPointers.clear();
308
                       KProcess *proc = new KProcess;
309
                       connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(gotAvailablePointers(KProcess *, char *, int)));
310
                        *proc << "xsetwacom" << "list";
311
                       if (!proc->start(KProcess::Block,KProcess::Stdout))
312
                               kdError("Could not ask xsetwacom for available pointers.");
313
                        else {
314
                               for ( QStringList::Iterator it = m_wacomPointers.begin(); it != m_wacomPointers.end(); ++it ) {
315
                                       KProcess *set = new KProcess;
316
                                       *set << "xsetwacom" << "set" << (*it) << "Rotate";
317
                                       switch (m_currentRotation) {
318
                                               case RR_Rotate_90:
319
                                                       *set << "CW";
320
                                                       break;
321
                                               case RR_Rotate_180:
322
                                                       *set << "HALF";
323
                                                       break;
324
                                               case RR_Rotate_270:
325
                                                       *set << "CCW";
326
                                                       break;
327
                                               default:
328
                                                       *set << "NONE";
329
                                       }
330
                                       if (!set->start())
331
                                               kdError("Could not set orientation for wacom pointers.");
332
                               }
333
                       }
334
               }
301
	}
335
	}
302
	else
336
	else
303
	{
337
	{
Lines 309-314 Link Here
309
	return ret;
343
	return ret;
310
}
344
}
311
345
346
void RandRCrtc::gotAvailablePointers(KProcess*, char *buffer, int len)
347
{
348
    QString myBuf = QString::fromLatin1(buffer, len);
349
    QStringList lines = QStringList::split('\n', myBuf);
350
    for ( QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
351
       QStringList split = QStringList::split(' ', (*it));
352
       m_wacomPointers+=split.first();
353
    }
354
}
355
312
bool RandRCrtc::proposeSize(QSize s)
356
bool RandRCrtc::proposeSize(QSize s)
313
{
357
{
314
	m_proposedRect.setSize(s);
358
	m_proposedRect.setSize(s);
(-)kcontrol/randr/randrcrtc.h (+7 lines)
Lines 26-31 Link Here
26
26
27
#ifdef HAS_RANDR_1_2
27
#ifdef HAS_RANDR_1_2
28
28
29
class KProcess;
30
29
class RandRCrtc : public QObject
31
class RandRCrtc : public QObject
30
{
32
{
31
	Q_OBJECT
33
	Q_OBJECT
Lines 62-67 Link Here
62
64
63
	ModeList modes() const;
65
	ModeList modes() const;
64
66
67
private slots:
68
        void gotAvailablePointers(KProcess*, char *buffer, int len);
69
65
signals:
70
signals:
66
	void crtcChanged(RRCrtc c, int changes);
71
	void crtcChanged(RRCrtc c, int changes);
67
72
Lines 86-91 Link Here
86
	float m_currentRate;
91
	float m_currentRate;
87
92
88
	RandRScreen *m_screen;
93
	RandRScreen *m_screen;
94
95
	QStringList m_wacomPointers;
89
};
96
};
90
#endif
97
#endif
91
98

Return to bug 385149