summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kernel/qdesktopwidget_x11.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/kernel/qdesktopwidget_x11.cpp b/src/kernel/qdesktopwidget_x11.cpp
index 449af4ffc..ecfa7e277 100644
--- a/src/kernel/qdesktopwidget_x11.cpp
+++ b/src/kernel/qdesktopwidget_x11.cpp
@@ -147,8 +147,8 @@ void TQDesktopWidgetPrivate::init()
workareas = new TQRect[ newScreenCount ];
// get the geometry of each screen
- int i, j, x, y, w, h;
- for ( i = 0, j = 0; i < newScreenCount; i++ ) {
+ int i, x, y, w, h;
+ for ( i = 0; i < newScreenCount; i++ ) {
#ifndef TQT_NO_XINERAMA
if (use_xinerama) {
@@ -166,27 +166,17 @@ void TQDesktopWidgetPrivate::init()
}
workareas[i] = TQRect();
- rects[j].setRect(x, y, w, h);
-
- // overlapping?
- if (j > 0 && rects[j-1].intersects(rects[j])) {
- // pick the bigger one, ignore the other
- if ((rects[j].width()*rects[j].height()) >
- (rects[j-1].width()*rects[j-1].height()))
- rects[j-1] = rects[j];
- }
- else
- j++;
+ rects[i].setRect(x, y, w, h);
}
if (screens) {
// leaks TQWidget* pointers on purpose, can't delete them as pointer escapes
- screens = (TQWidget**) realloc(screens, j * sizeof(TQWidget*));
- if (j > screenCount)
- memset(&screens[screenCount], 0, (j-screenCount) * sizeof(TQWidget*));
+ screens = (TQWidget**) realloc(screens, newScreenCount * sizeof(TQWidget*));
+ if (newScreenCount > screenCount)
+ memset(&screens[screenCount], 0, (newScreenCount-screenCount) * sizeof(TQWidget*));
}
- screenCount = j;
+ screenCount = newScreenCount;
#ifndef TQT_NO_XINERAMA
if (use_xinerama && screenCount == 1)
@@ -341,8 +331,12 @@ int TQDesktopWidget::screenNumber( TQWidget *widget ) const
int TQDesktopWidget::screenNumber( const TQPoint &point ) const
{
+ // check the default screen first
+ if ( d->rects[d->defaultScreen].contains( point ) )
+ return d->defaultScreen;
+
for ( int i = 0; i < d->screenCount; ++i ) {
- if ( d->rects[i].contains( point ) )
+ if ( i != d->defaultScreen && d->rects[i].contains( point ) )
return i;
}
return -1;