Magellan Linux

Contents of /trunk/kdelibs/patches/kdelibs-3.5.7-xinerama-improvements.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 221 - (show annotations) (download)
Sun Jun 10 22:41:45 2007 UTC (16 years, 11 months ago) by niro
File size: 20172 byte(s)
-rediff against 3.5.7

1 diff -ru kdelibs-3.5.7.orig/kdecore/kstartupinfo.cpp kdelibs-3.5.7/kdecore/kstartupinfo.cpp
2 --- kdelibs-3.5.7.orig/kdecore/kstartupinfo.cpp 2007-05-15 08:57:52.000000000 +0200
3 +++ kdelibs-3.5.7/kdecore/kstartupinfo.cpp 2007-05-15 08:58:27.000000000 +0200
4 @@ -1105,7 +1105,7 @@
5 struct KStartupInfoDataPrivate
6 {
7 KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ),
8 - silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ) {};
9 + silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {};
10 QString bin;
11 QString name;
12 QString description;
13 @@ -1117,6 +1117,8 @@
14 KStartupInfoData::TriState silent;
15 unsigned long timestamp;
16 int screen;
17 + int xinerama;
18 + WId launched_by;
19 };
20
21 QString KStartupInfoData::to_text() const
22 @@ -1147,6 +1149,10 @@
23 ret += QString::fromLatin1( " TIMESTAMP=%1" ).arg( d->timestamp );
24 if( d->screen != -1 )
25 ret += QString::fromLatin1( " SCREEN=%1" ).arg( d->screen );
26 + if( d->xinerama != -1 )
27 + ret += QString::fromLatin1( " XINERAMA=%1" ).arg( d->xinerama );
28 + if( d->launched_by != 0 )
29 + ret += QString::fromLatin1( " LAUNCHED_BY=%1" ).arg( d->launched_by );
30 return ret;
31 }
32
33 @@ -1165,6 +1171,8 @@
34 const QString silent_str = QString::fromLatin1( "SILENT=" );
35 const QString timestamp_str = QString::fromLatin1( "TIMESTAMP=" );
36 const QString screen_str = QString::fromLatin1( "SCREEN=" );
37 + const QString xinerama_str = QString::fromLatin1( "XINERAMA=" );
38 + const QString launched_by_str = QString::fromLatin1( "LAUNCHED_BY=" );
39 for( QStringList::Iterator it = items.begin();
40 it != items.end();
41 ++it )
42 @@ -1195,6 +1203,10 @@
43 d->timestamp = get_unum( *it );
44 else if( ( *it ).startsWith( screen_str ))
45 d->screen = get_num( *it );
46 + else if( ( *it ).startsWith( xinerama_str ))
47 + d->xinerama = get_num( *it );
48 + else if( ( *it ).startsWith( launched_by_str ))
49 + d->launched_by = get_num( *it );
50 }
51 }
52
53 @@ -1238,6 +1250,10 @@
54 d->timestamp = data_P.timestamp();
55 if( data_P.screen() != -1 )
56 d->screen = data_P.screen();
57 + if( data_P.xinerama() != -1 && xinerama() != -1 ) // don't overwrite
58 + d->xinerama = data_P.xinerama();
59 + if( data_P.launchedBy() != 0 && launchedBy() != 0 ) // don't overwrite
60 + d->launched_by = data_P.launchedBy();
61 }
62
63 KStartupInfoData::KStartupInfoData()
64 @@ -1408,6 +1424,26 @@
65 return d->screen;
66 }
67
68 +void KStartupInfoData::setXinerama( int xinerama )
69 + {
70 + d->xinerama = xinerama;
71 + }
72 +
73 +int KStartupInfoData::xinerama() const
74 + {
75 + return d->xinerama;
76 + }
77 +
78 +void KStartupInfoData::setLaunchedBy( WId window )
79 + {
80 + d->launched_by = window;
81 + }
82 +
83 +WId KStartupInfoData::launchedBy() const
84 + {
85 + return d->launched_by;
86 + }
87 +
88 static
89 long get_num( const QString& item_P )
90 {
91 diff -ru kdelibs-3.5.7.orig/kdecore/kstartupinfo.h kdelibs-3.5.7/kdecore/kstartupinfo.h
92 --- kdelibs-3.5.7.orig/kdecore/kstartupinfo.h 2007-05-15 08:57:52.000000000 +0200
93 +++ kdelibs-3.5.7/kdecore/kstartupinfo.h 2007-05-15 08:58:27.000000000 +0200
94 @@ -635,6 +635,30 @@
95 * This is usually not necessary to set, as it's set by default to qt_xscreen().
96 */
97 void setScreen( int screen );
98 +
99 + /**
100 + * The Xinerama screen for the startup notification, -1 if unknown.
101 + */
102 + int xinerama() const;
103 +
104 + /**
105 + * Sets the Xinerama screen for the startup notification ( i.e. the screeen on which
106 + * the starting application should appear ).
107 + * @param xinerama the Xinerama screen for the startup notification
108 + */
109 + void setXinerama( int xinerama );
110 +
111 + /**
112 + * The toplevel window of the application that caused this startup notification,
113 + * 0 if unknown.
114 + */
115 + WId launchedBy() const;
116 +
117 + /**
118 + * Sets the toplevel window of the application that caused this startup notification.
119 + * @param window window ID of the toplevel window that is responsible for this startup
120 + */
121 + void setLaunchedBy( WId window );
122
123 /**
124 * Updates the notification data from the given data. Some data, such as the desktop
125 diff -ru kdelibs-3.5.7.orig/kdecore/netwm.cpp kdelibs-3.5.7/kdecore/netwm.cpp
126 --- kdelibs-3.5.7.orig/kdecore/netwm.cpp 2007-05-15 08:57:52.000000000 +0200
127 +++ kdelibs-3.5.7/kdecore/netwm.cpp 2007-05-15 08:59:01.000000000 +0200
128 @@ -144,6 +144,9 @@
129 // used to determine whether application window is managed or not
130 static Atom xa_wm_state = 0;
131
132 +// ability flags
133 +static Atom net_wm_full_placement = 0;
134 +
135 static Bool netwm_atoms_created = False;
136 const unsigned long netwm_sendevent_mask = (SubstructureRedirectMask|
137 SubstructureNotifyMask);
138 @@ -235,7 +238,7 @@
139 }
140
141
142 -static const int netAtomCount = 83;
143 +static const int netAtomCount = 84;
144 static void create_atoms(Display *d) {
145 static const char * const names[netAtomCount] =
146 {
147 @@ -328,7 +331,9 @@
148 "_KDE_NET_WM_TEMPORARY_RULES",
149
150 "WM_STATE",
151 - "WM_PROTOCOLS"
152 + "WM_PROTOCOLS",
153 +
154 + "_NET_WM_FULL_PLACEMENT"
155 };
156
157 Atom atoms[netAtomCount], *atomsp[netAtomCount] =
158 @@ -422,7 +427,9 @@
159 &kde_net_wm_temporary_rules,
160
161 &xa_wm_state,
162 - &wm_protocols
163 + &wm_protocols,
164 +
165 + &net_wm_full_placement
166 };
167
168 assert( !netwm_atoms_created );
169 @@ -1339,6 +1346,8 @@
170
171 if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules)
172 atoms[pnum++] = kde_net_wm_temporary_rules;
173 + if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement)
174 + atoms[pnum++] = net_wm_full_placement;
175
176 XChangeProperty(p->display, p->root, net_supported, XA_ATOM, 32,
177 PropModeReplace, (unsigned char *) atoms, pnum);
178 @@ -1568,6 +1577,8 @@
179
180 else if( atom == kde_net_wm_temporary_rules )
181 p->properties[ PROTOCOLS2 ] |= WM2KDETemporaryRules;
182 + else if( atom == net_wm_full_placement )
183 + p->properties[ PROTOCOLS2 ] |= WM2FullPlacement;
184 }
185
186 extern Time qt_x_user_time;
187 Only in kdelibs-3.5.7/kdecore: netwm.cpp.orig
188 diff -ru kdelibs-3.5.7.orig/kdecore/netwm_def.h kdelibs-3.5.7/kdecore/netwm_def.h
189 --- kdelibs-3.5.7.orig/kdecore/netwm_def.h 2007-05-15 08:57:52.000000000 +0200
190 +++ kdelibs-3.5.7/kdecore/netwm_def.h 2007-05-15 08:58:27.000000000 +0200
191 @@ -608,7 +608,8 @@
192 WM2WindowClass = 1<<10, ///< @since 3.3
193 WM2WindowRole = 1<<11, ///< @since 3.3
194 WM2ClientMachine = 1<<12, ///< @since 3.3
195 - WM2ShowingDesktop = 1<<13 ///< @since 3.5
196 + WM2ShowingDesktop = 1<<13, ///< @since 3.5
197 + WM2FullPlacement = 1<<14
198 };
199
200 /**
201 Only in kdelibs-3.5.7/kdecore: netwm_def.h.orig
202 diff -ru kdelibs-3.5.7.orig/kio/kio/krun.cpp kdelibs-3.5.7/kio/kio/krun.cpp
203 --- kdelibs-3.5.7.orig/kio/kio/krun.cpp 2007-05-15 08:57:52.000000000 +0200
204 +++ kdelibs-3.5.7/kio/kio/krun.cpp 2007-05-15 08:58:27.000000000 +0200
205 @@ -77,6 +77,7 @@
206 QString m_localPath;
207 QString m_suggestedFileName;
208 QGuardedPtr <QWidget> m_window;
209 + QCString m_asn;
210 };
211
212 pid_t KRun::runURL( const KURL& u, const QString& _mimetype )
213 @@ -109,14 +110,20 @@
214 return false;
215 }
216
217 -// This is called by foundMimeType, since it knows the mimetype of the URL
218 pid_t KRun::runURL( const KURL& u, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName )
219 {
220 + return runURL( u, _mimetype, NULL, "", tempFile, runExecutables, suggestedFileName );
221 +}
222 +
223 +// This is called by foundMimeType, since it knows the mimetype of the URL
224 +pid_t KRun::runURL( const KURL& u, const QString& _mimetype, QWidget* window, const QCString& asn,
225 + bool tempFile, bool runExecutables, const QString& suggestedFileName )
226 +{
227 bool noRun = false;
228 bool noAuth = false;
229 if ( _mimetype == "inode/directory-locked" )
230 {
231 - KMessageBoxWrapper::error( 0L,
232 + KMessageBoxWrapper::error( window,
233 i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>").arg(u.htmlURL()) );
234 return 0;
235 }
236 @@ -133,7 +140,7 @@
237 {
238 QString path = u.path();
239 shellQuote( path );
240 - return (KRun::runCommand(path)); // just execute the url as a command
241 + return (KRun::runCommand(path, QString::null, QString::null, window, asn)); // just execute the url as a command
242 // ## TODO implement deleting the file if tempFile==true
243 }
244 else
245 @@ -155,14 +162,14 @@
246
247 if ( noRun )
248 {
249 - KMessageBox::sorry( 0L,
250 + KMessageBox::sorry( window,
251 i18n("<qt>The file <b>%1</b> is an executable program. "
252 "For safety it will not be started.</qt>").arg(u.htmlURL()));
253 return 0;
254 }
255 if ( noAuth )
256 {
257 - KMessageBoxWrapper::error( 0L,
258 + KMessageBoxWrapper::error( window,
259 i18n("<qt>You do not have permission to run <b>%1</b>.</qt>").arg(u.htmlURL()) );
260 return 0;
261 }
262 @@ -182,7 +189,7 @@
263 return displayOpenWithDialog( lst, tempFile, suggestedFileName );
264 }
265
266 - return KRun::run( *offer, lst, 0 /*window*/, tempFile, suggestedFileName );
267 + return KRun::run( *offer, lst, window, asn, tempFile, suggestedFileName );
268 }
269
270 bool KRun::displayOpenWithDialog( const KURL::List& lst )
271 @@ -536,13 +543,13 @@
272 }
273
274 static pid_t runCommandInternal( KProcess* proc, const KService* service, const QString& binName,
275 - const QString &execName, const QString & iconName )
276 + const QString &execName, const QString & iconName, QWidget* window, QCString asn )
277 {
278 if (service && !service->desktopEntryPath().isEmpty()
279 && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() ))
280 {
281 kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl;
282 - KMessageBox::sorry(0, i18n("You are not authorized to execute this file."));
283 + KMessageBox::sorry(window, i18n("You are not authorized to execute this file."));
284 return 0;
285 }
286 QString bin = KRun::binaryName( binName, true );
287 @@ -550,10 +557,10 @@
288 bool silent;
289 QCString wmclass;
290 KStartupInfoId id;
291 - bool startup_notify = KRun::checkStartupNotify( binName, service, &silent, &wmclass );
292 + bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass ));
293 if( startup_notify )
294 {
295 - id.initId();
296 + id.initId( asn );
297 id.setupStartupEnv();
298 KStartupInfoData data;
299 data.setHostname();
300 @@ -572,6 +579,8 @@
301 if( silent )
302 data.setSilent( KStartupInfoData::Yes );
303 data.setDesktop( KWin::currentDesktop());
304 + if( window )
305 + data.setLaunchedBy( window->winId());
306 KStartupInfo::sendStartup( id, data );
307 }
308 pid_t pid = KProcessRunner::run( proc, binName, id );
309 @@ -629,7 +638,8 @@
310 return true;
311 }
312
313 -static pid_t runTempService( const KService& _service, const KURL::List& _urls, bool tempFiles, const QString& suggestedFileName )
314 +static pid_t runTempService( const KService& _service, const KURL::List& _urls, QWidget* window,
315 + const QCString& asn, bool tempFiles, const QString& suggestedFileName )
316 {
317 if (!_urls.isEmpty()) {
318 kdDebug(7010) << "runTempService: first url " << _urls.first().url() << endl;
319 @@ -648,7 +658,7 @@
320 {
321 KURL::List singleUrl;
322 singleUrl.append(*it);
323 - runTempService( _service, singleUrl, tempFiles, suggestedFileName );
324 + runTempService( _service, singleUrl, window, "", tempFiles, suggestedFileName );
325 }
326 KURL::List singleUrl;
327 singleUrl.append(_urls.first());
328 @@ -667,7 +677,7 @@
329 proc->setWorkingDirectory(_service.path());
330
331 return runCommandInternal( proc, &_service, KRun::binaryName( _service.exec(), false ),
332 - _service.name(), _service.icon() );
333 + _service.name(), _service.icon(), window, asn );
334 }
335
336 // WARNING: don't call this from processDesktopExec, since klauncher uses that too...
337 @@ -728,11 +738,22 @@
338
339 pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles )
340 {
341 - return run( _service, _urls, window, tempFiles, QString::null );
342 + return run( _service, _urls, window, "", tempFiles, QString::null );
343 +}
344 +
345 +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn, bool tempFiles )
346 +{
347 + return run( _service, _urls, window, asn, tempFiles, QString::null );
348 }
349
350 pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName )
351 {
352 + return run( _service, _urls, window, "", tempFiles, suggestedFileName );
353 +}
354 +
355 +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn,
356 + bool tempFiles, const QString& suggestedFileName )
357 +{
358 if (!_service.desktopEntryPath().isEmpty() &&
359 !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath()))
360 {
361 @@ -753,7 +774,7 @@
362
363 if ( tempFiles || _service.desktopEntryPath().isEmpty() || !suggestedFileName.isEmpty() )
364 {
365 - return runTempService(_service, _urls, tempFiles, suggestedFileName);
366 + return runTempService(_service, _urls, window, asn, tempFiles, suggestedFileName);
367 }
368
369 kdDebug(7010) << "KRun::run " << _service.desktopEntryPath() << endl;
370 @@ -767,9 +788,25 @@
371
372 QString error;
373 int pid = 0;
374 -
375 +
376 + QCString myasn = asn;
377 + // startServiceByDesktopPath() doesn't take QWidget*, add it to the startup info now
378 + if( window != NULL )
379 + {
380 + if( myasn.isEmpty())
381 + myasn = KStartupInfo::createNewStartupId();
382 + if( myasn != "0" )
383 + {
384 + KStartupInfoId id;
385 + id.initId( myasn );
386 + KStartupInfoData data;
387 + data.setLaunchedBy( window->winId());
388 + KStartupInfo::sendChange( id, data );
389 + }
390 + }
391 +
392 int i = KApplication::startServiceByDesktopPath(
393 - _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid
394 + _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid, myasn
395 );
396
397 if (i != 0)
398 @@ -794,33 +831,47 @@
399
400 pid_t KRun::runCommand( QString cmd )
401 {
402 - return KRun::runCommand( cmd, QString::null, QString::null );
403 + return KRun::runCommand( cmd, QString::null, QString::null, NULL, "" );
404 }
405
406 pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName )
407 {
408 + return KRun::runCommand( cmd, execName, iconName, NULL, "" );
409 +}
410 +
411 +pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName,
412 + QWidget* window, const QCString& asn )
413 +{
414 kdDebug(7010) << "runCommand " << cmd << "," << execName << endl;
415 KProcess * proc = new KProcess;
416 proc->setUseShell(true);
417 *proc << cmd;
418 KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) );
419 - return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName );
420 + return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName,
421 + window, asn );
422 }
423
424 KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo )
425 :m_timer(0,"KRun::timer")
426 {
427 - init (url, 0, mode, isLocalFile, showProgressInfo);
428 + init (url, 0, "", mode, isLocalFile, showProgressInfo);
429 }
430
431 KRun::KRun( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
432 bool showProgressInfo )
433 :m_timer(0,"KRun::timer")
434 {
435 - init (url, window, mode, isLocalFile, showProgressInfo);
436 + init (url, window, "", mode, isLocalFile, showProgressInfo);
437 +}
438 +
439 +KRun::KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
440 + bool showProgressInfo )
441 + :m_timer(0,"KRun::timer")
442 +{
443 + init (url, window, asn, mode, isLocalFile, showProgressInfo);
444 }
445
446 -void KRun::init ( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
447 +void KRun::init ( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
448 bool showProgressInfo )
449 {
450 m_bFault = false;
451 @@ -836,6 +887,7 @@
452 d = new KRunPrivate;
453 d->m_runExecutables = true;
454 d->m_window = window;
455 + d->m_asn = asn;
456 setEnableExternalBrowser(true);
457
458 // Start the timer. This means we will return to the event
459 @@ -936,7 +988,7 @@
460 KService::Ptr service = KService::serviceByStorageId( exec );
461 if (service)
462 {
463 - run( *service, urls );
464 + run( *service, urls, d->m_window, d->m_asn );
465 ok = true;
466 }
467 }
468 @@ -1229,7 +1281,7 @@
469 {
470 KURL::List lst;
471 lst.append( m_strURL );
472 - m_bFinished = KRun::run( *serv, lst );
473 + m_bFinished = KRun::run( *serv, lst, d->m_window, d->m_asn );
474 /// Note: the line above means that if that service failed, we'll
475 /// go to runURL to maybe find another service, even though a dialog
476 /// box was displayed. That's good if runURL tries another service,
477 @@ -1244,7 +1296,7 @@
478 m_strURL.setPath( d->m_localPath );
479 }
480
481 - if (!m_bFinished && KRun::runURL( m_strURL, type, false, d->m_runExecutables, d->m_suggestedFileName )){
482 + if (!m_bFinished && KRun::runURL( m_strURL, type, d->m_window, d->m_asn, false, d->m_runExecutables, d->m_suggestedFileName )){
483 m_bFinished = true;
484 }
485 else{
486 diff -ru kdelibs-3.5.7.orig/kio/kio/krun.h kdelibs-3.5.7/kio/kio/krun.h
487 --- kdelibs-3.5.7.orig/kio/kio/krun.h 2007-05-15 08:57:52.000000000 +0200
488 +++ kdelibs-3.5.7/kio/kio/krun.h 2007-05-15 08:58:27.000000000 +0200
489 @@ -111,6 +111,8 @@
490 */
491 KRun( const KURL& url, QWidget* window, mode_t mode = 0,
492 bool isLocalFile = false, bool showProgressInfo = true );
493 + KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode = 0,
494 + bool isLocalFile = false, bool showProgressInfo = true );
495
496 /**
497 * Destructor. Don't call it yourself, since a KRun object auto-deletes
498 @@ -210,6 +212,8 @@
499 * @since 3.5.2
500 */
501 static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles = false );
502 + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
503 + const QCString& asn, bool tempFiles = false );
504 /**
505 * Open a list of URLs with a certain service (application).
506 *
507 @@ -226,6 +230,8 @@
508 /// @since 3.5.3
509 /// @internal
510 static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName );
511 + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
512 + const QCString& asn, bool tempFiles, const QString& suggestedFileName );
513
514 /**
515 * Open a list of URLs with.
516 @@ -269,6 +275,7 @@
517 static pid_t runURL( const KURL& _url, const QString& _mimetype );
518 /// @since 3.5.3
519 /// @internal
520 + static pid_t runURL( const KURL& _url, const QString& _mimetype, QWidget* window, const QCString& asn, bool tempFile, bool runExecutables, const QString& suggestedFileName );
521 static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName );
522
523 /**
524 @@ -299,6 +306,8 @@
525 * of running command) if command was unsafe for map notification.
526 */
527 static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon );
528 + static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon,
529 + QWidget* window, const QCString& asn );
530
531 /**
532 * Display the Open-With dialog for those URLs, and run the chosen application.
533 @@ -438,7 +447,7 @@
534 virtual void virtual_hook( int id, void* data );
535
536 private:
537 - void init (const KURL& url, QWidget* window, mode_t mode,
538 + void init (const KURL& url, QWidget* window, const QCString& asn, mode_t mode,
539 bool isLocalFile, bool showProgressInfo);
540 private:
541 class KRunPrivate;