Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 391 - (show annotations) (download)
Sat Nov 3 12:50:46 2007 UTC (16 years, 6 months ago) by niro
File size: 20231 byte(s)
-ver bump to 3.5.8-r1

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 = 84;
143 +static const int netAtomCount = 85;
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 WM2DesktopLayout = 1<<15 ///< @since 3.5.8
199 };
200
201 /**
202 Only in kdelibs-3.5.7/kdecore: netwm_def.h.orig
203 diff -ru kdelibs-3.5.7.orig/kio/kio/krun.cpp kdelibs-3.5.7/kio/kio/krun.cpp
204 --- kdelibs-3.5.7.orig/kio/kio/krun.cpp 2007-05-15 08:57:52.000000000 +0200
205 +++ kdelibs-3.5.7/kio/kio/krun.cpp 2007-05-15 08:58:27.000000000 +0200
206 @@ -77,6 +77,7 @@
207 QString m_localPath;
208 QString m_suggestedFileName;
209 QGuardedPtr <QWidget> m_window;
210 + QCString m_asn;
211 };
212
213 pid_t KRun::runURL( const KURL& u, const QString& _mimetype )
214 @@ -109,14 +110,20 @@
215 return false;
216 }
217
218 -// This is called by foundMimeType, since it knows the mimetype of the URL
219 pid_t KRun::runURL( const KURL& u, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName )
220 {
221 + return runURL( u, _mimetype, NULL, "", tempFile, runExecutables, suggestedFileName );
222 +}
223 +
224 +// This is called by foundMimeType, since it knows the mimetype of the URL
225 +pid_t KRun::runURL( const KURL& u, const QString& _mimetype, QWidget* window, const QCString& asn,
226 + bool tempFile, bool runExecutables, const QString& suggestedFileName )
227 +{
228 bool noRun = false;
229 bool noAuth = false;
230 if ( _mimetype == "inode/directory-locked" )
231 {
232 - KMessageBoxWrapper::error( 0L,
233 + KMessageBoxWrapper::error( window,
234 i18n("<qt>Unable to enter <b>%1</b>.\nYou do not have access rights to this location.</qt>").arg(u.htmlURL()) );
235 return 0;
236 }
237 @@ -133,7 +140,7 @@
238 {
239 QString path = u.path();
240 shellQuote( path );
241 - return (KRun::runCommand(path)); // just execute the url as a command
242 + return (KRun::runCommand(path, QString::null, QString::null, window, asn)); // just execute the url as a command
243 // ## TODO implement deleting the file if tempFile==true
244 }
245 else
246 @@ -155,14 +162,14 @@
247
248 if ( noRun )
249 {
250 - KMessageBox::sorry( 0L,
251 + KMessageBox::sorry( window,
252 i18n("<qt>The file <b>%1</b> is an executable program. "
253 "For safety it will not be started.</qt>").arg(u.htmlURL()));
254 return 0;
255 }
256 if ( noAuth )
257 {
258 - KMessageBoxWrapper::error( 0L,
259 + KMessageBoxWrapper::error( window,
260 i18n("<qt>You do not have permission to run <b>%1</b>.</qt>").arg(u.htmlURL()) );
261 return 0;
262 }
263 @@ -182,7 +189,7 @@
264 return displayOpenWithDialog( lst, tempFile, suggestedFileName );
265 }
266
267 - return KRun::run( *offer, lst, 0 /*window*/, tempFile, suggestedFileName );
268 + return KRun::run( *offer, lst, window, asn, tempFile, suggestedFileName );
269 }
270
271 bool KRun::displayOpenWithDialog( const KURL::List& lst )
272 @@ -536,13 +543,13 @@
273 }
274
275 static pid_t runCommandInternal( KProcess* proc, const KService* service, const QString& binName,
276 - const QString &execName, const QString & iconName )
277 + const QString &execName, const QString & iconName, QWidget* window, QCString asn )
278 {
279 if (service && !service->desktopEntryPath().isEmpty()
280 && !KDesktopFile::isAuthorizedDesktopFile( service->desktopEntryPath() ))
281 {
282 kdWarning() << "No authorization to execute " << service->desktopEntryPath() << endl;
283 - KMessageBox::sorry(0, i18n("You are not authorized to execute this file."));
284 + KMessageBox::sorry(window, i18n("You are not authorized to execute this file."));
285 return 0;
286 }
287 QString bin = KRun::binaryName( binName, true );
288 @@ -550,10 +557,10 @@
289 bool silent;
290 QCString wmclass;
291 KStartupInfoId id;
292 - bool startup_notify = KRun::checkStartupNotify( binName, service, &silent, &wmclass );
293 + bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass ));
294 if( startup_notify )
295 {
296 - id.initId();
297 + id.initId( asn );
298 id.setupStartupEnv();
299 KStartupInfoData data;
300 data.setHostname();
301 @@ -572,6 +579,8 @@
302 if( silent )
303 data.setSilent( KStartupInfoData::Yes );
304 data.setDesktop( KWin::currentDesktop());
305 + if( window )
306 + data.setLaunchedBy( window->winId());
307 KStartupInfo::sendStartup( id, data );
308 }
309 pid_t pid = KProcessRunner::run( proc, binName, id );
310 @@ -629,7 +638,8 @@
311 return true;
312 }
313
314 -static pid_t runTempService( const KService& _service, const KURL::List& _urls, bool tempFiles, const QString& suggestedFileName )
315 +static pid_t runTempService( const KService& _service, const KURL::List& _urls, QWidget* window,
316 + const QCString& asn, bool tempFiles, const QString& suggestedFileName )
317 {
318 if (!_urls.isEmpty()) {
319 kdDebug(7010) << "runTempService: first url " << _urls.first().url() << endl;
320 @@ -648,7 +658,7 @@
321 {
322 KURL::List singleUrl;
323 singleUrl.append(*it);
324 - runTempService( _service, singleUrl, tempFiles, suggestedFileName );
325 + runTempService( _service, singleUrl, window, "", tempFiles, suggestedFileName );
326 }
327 KURL::List singleUrl;
328 singleUrl.append(_urls.first());
329 @@ -667,7 +677,7 @@
330 proc->setWorkingDirectory(_service.path());
331
332 return runCommandInternal( proc, &_service, KRun::binaryName( _service.exec(), false ),
333 - _service.name(), _service.icon() );
334 + _service.name(), _service.icon(), window, asn );
335 }
336
337 // WARNING: don't call this from processDesktopExec, since klauncher uses that too...
338 @@ -728,11 +738,22 @@
339
340 pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles )
341 {
342 - return run( _service, _urls, window, tempFiles, QString::null );
343 + return run( _service, _urls, window, "", tempFiles, QString::null );
344 +}
345 +
346 +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn, bool tempFiles )
347 +{
348 + return run( _service, _urls, window, asn, tempFiles, QString::null );
349 }
350
351 pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName )
352 {
353 + return run( _service, _urls, window, "", tempFiles, suggestedFileName );
354 +}
355 +
356 +pid_t KRun::run( const KService& _service, const KURL::List& _urls, QWidget* window, const QCString& asn,
357 + bool tempFiles, const QString& suggestedFileName )
358 +{
359 if (!_service.desktopEntryPath().isEmpty() &&
360 !KDesktopFile::isAuthorizedDesktopFile( _service.desktopEntryPath()))
361 {
362 @@ -753,7 +774,7 @@
363
364 if ( tempFiles || _service.desktopEntryPath().isEmpty() || !suggestedFileName.isEmpty() )
365 {
366 - return runTempService(_service, _urls, tempFiles, suggestedFileName);
367 + return runTempService(_service, _urls, window, asn, tempFiles, suggestedFileName);
368 }
369
370 kdDebug(7010) << "KRun::run " << _service.desktopEntryPath() << endl;
371 @@ -767,9 +788,25 @@
372
373 QString error;
374 int pid = 0;
375 -
376 +
377 + QCString myasn = asn;
378 + // startServiceByDesktopPath() doesn't take QWidget*, add it to the startup info now
379 + if( window != NULL )
380 + {
381 + if( myasn.isEmpty())
382 + myasn = KStartupInfo::createNewStartupId();
383 + if( myasn != "0" )
384 + {
385 + KStartupInfoId id;
386 + id.initId( myasn );
387 + KStartupInfoData data;
388 + data.setLaunchedBy( window->winId());
389 + KStartupInfo::sendChange( id, data );
390 + }
391 + }
392 +
393 int i = KApplication::startServiceByDesktopPath(
394 - _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid
395 + _service.desktopEntryPath(), urls.toStringList(), &error, 0L, &pid, myasn
396 );
397
398 if (i != 0)
399 @@ -794,33 +831,47 @@
400
401 pid_t KRun::runCommand( QString cmd )
402 {
403 - return KRun::runCommand( cmd, QString::null, QString::null );
404 + return KRun::runCommand( cmd, QString::null, QString::null, NULL, "" );
405 }
406
407 pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName )
408 {
409 + return KRun::runCommand( cmd, execName, iconName, NULL, "" );
410 +}
411 +
412 +pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QString & iconName,
413 + QWidget* window, const QCString& asn )
414 +{
415 kdDebug(7010) << "runCommand " << cmd << "," << execName << endl;
416 KProcess * proc = new KProcess;
417 proc->setUseShell(true);
418 *proc << cmd;
419 KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) );
420 - return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName );
421 + return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName,
422 + window, asn );
423 }
424
425 KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo )
426 :m_timer(0,"KRun::timer")
427 {
428 - init (url, 0, mode, isLocalFile, showProgressInfo);
429 + init (url, 0, "", mode, isLocalFile, showProgressInfo);
430 }
431
432 KRun::KRun( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
433 bool showProgressInfo )
434 :m_timer(0,"KRun::timer")
435 {
436 - init (url, window, mode, isLocalFile, showProgressInfo);
437 + init (url, window, "", mode, isLocalFile, showProgressInfo);
438 +}
439 +
440 +KRun::KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
441 + bool showProgressInfo )
442 + :m_timer(0,"KRun::timer")
443 +{
444 + init (url, window, asn, mode, isLocalFile, showProgressInfo);
445 }
446
447 -void KRun::init ( const KURL& url, QWidget* window, mode_t mode, bool isLocalFile,
448 +void KRun::init ( const KURL& url, QWidget* window, const QCString& asn, mode_t mode, bool isLocalFile,
449 bool showProgressInfo )
450 {
451 m_bFault = false;
452 @@ -836,6 +887,7 @@
453 d = new KRunPrivate;
454 d->m_runExecutables = true;
455 d->m_window = window;
456 + d->m_asn = asn;
457 setEnableExternalBrowser(true);
458
459 // Start the timer. This means we will return to the event
460 @@ -936,7 +988,7 @@
461 KService::Ptr service = KService::serviceByStorageId( exec );
462 if (service)
463 {
464 - run( *service, urls );
465 + run( *service, urls, d->m_window, d->m_asn );
466 ok = true;
467 }
468 }
469 @@ -1229,7 +1281,7 @@
470 {
471 KURL::List lst;
472 lst.append( m_strURL );
473 - m_bFinished = KRun::run( *serv, lst );
474 + m_bFinished = KRun::run( *serv, lst, d->m_window, d->m_asn );
475 /// Note: the line above means that if that service failed, we'll
476 /// go to runURL to maybe find another service, even though a dialog
477 /// box was displayed. That's good if runURL tries another service,
478 @@ -1244,7 +1296,7 @@
479 m_strURL.setPath( d->m_localPath );
480 }
481
482 - if (!m_bFinished && KRun::runURL( m_strURL, type, false, d->m_runExecutables, d->m_suggestedFileName )){
483 + if (!m_bFinished && KRun::runURL( m_strURL, type, d->m_window, d->m_asn, false, d->m_runExecutables, d->m_suggestedFileName )){
484 m_bFinished = true;
485 }
486 else{
487 diff -ru kdelibs-3.5.7.orig/kio/kio/krun.h kdelibs-3.5.7/kio/kio/krun.h
488 --- kdelibs-3.5.7.orig/kio/kio/krun.h 2007-05-15 08:57:52.000000000 +0200
489 +++ kdelibs-3.5.7/kio/kio/krun.h 2007-05-15 08:58:27.000000000 +0200
490 @@ -111,6 +111,8 @@
491 */
492 KRun( const KURL& url, QWidget* window, mode_t mode = 0,
493 bool isLocalFile = false, bool showProgressInfo = true );
494 + KRun( const KURL& url, QWidget* window, const QCString& asn, mode_t mode = 0,
495 + bool isLocalFile = false, bool showProgressInfo = true );
496
497 /**
498 * Destructor. Don't call it yourself, since a KRun object auto-deletes
499 @@ -210,6 +212,8 @@
500 * @since 3.5.2
501 */
502 static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles = false );
503 + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
504 + const QCString& asn, bool tempFiles = false );
505 /**
506 * Open a list of URLs with a certain service (application).
507 *
508 @@ -226,6 +230,8 @@
509 /// @since 3.5.3
510 /// @internal
511 static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window, bool tempFiles, const QString& suggestedFileName );
512 + static pid_t run( const KService& _service, const KURL::List& _urls, QWidget* window,
513 + const QCString& asn, bool tempFiles, const QString& suggestedFileName );
514
515 /**
516 * Open a list of URLs with.
517 @@ -269,6 +275,7 @@
518 static pid_t runURL( const KURL& _url, const QString& _mimetype );
519 /// @since 3.5.3
520 /// @internal
521 + static pid_t runURL( const KURL& _url, const QString& _mimetype, QWidget* window, const QCString& asn, bool tempFile, bool runExecutables, const QString& suggestedFileName );
522 static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile, bool runExecutables, const QString& suggestedFileName );
523
524 /**
525 @@ -299,6 +306,8 @@
526 * of running command) if command was unsafe for map notification.
527 */
528 static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon );
529 + static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon,
530 + QWidget* window, const QCString& asn );
531
532 /**
533 * Display the Open-With dialog for those URLs, and run the chosen application.
534 @@ -438,7 +447,7 @@
535 virtual void virtual_hook( int id, void* data );
536
537 private:
538 - void init (const KURL& url, QWidget* window, mode_t mode,
539 + void init (const KURL& url, QWidget* window, const QCString& asn, mode_t mode,
540 bool isLocalFile, bool showProgressInfo);
541 private:
542 class KRunPrivate;