"smart" window placement puts windows on top of each other while there is plenty of space

Bug #1004371 reported by Ronan Le Hy
50
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Compiz
Confirmed
Low
MC Return
compiz (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Consider the following program that opens 5 small windows:

  #!/usr/bin/python
  import cv2
  import numpy as np
  for i in range(5):
      cv2.imshow(str(i), np.random.random_integers(0,255,(64,128,3)).astype(np.uint8))
  cv2.waitKey(-1)

(needs python-opencv and python-numpy)

When I run it, all 5 windows appear exactly on top of each other. My desktop is stretched over two monitors. Left monitor has nothing on it, right one has emacs not maximized, the 5 windows pop up on top left of the left screen.

I expect that the windows would appear in a way that they do not overlap, since there is plenty of space on both screens for that.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: unity 5.12-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-24.38-generic 3.2.16
Uname: Linux 3.2.0-24-generic x86_64
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
CompizPlugins: [core,composite,opengl,decor,compiztoolbox,snap,gnomecompat,regex,grid,resize,imgpng,mousepoll,place,move,vpswitch,animation,session,wall,expo,workarounds,unitymtgrabhandles,ezoom,fade,scale,unityshell]
Date: Fri May 25 10:34:20 2012
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Release Candidate amd64 (20100419.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=fr_FR.utf8
 SHELL=/bin/zsh
SourcePackage: unity
UpgradeStatus: Upgraded to precise on 2012-05-02 (22 days ago)

Revision history for this message
Ronan Le Hy (rlehy) wrote :
affects: unity (Ubuntu) → compiz (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in compiz (Ubuntu):
status: New → Confirmed
Revision history for this message
Jukka Lehtosalo (jukkaleh) wrote :

I have the same problem. I have a fresh install of 12.04 and a desktop spanning two monitors. With 'smart' window placement windows (e.g. xterm, emacs, gedit) seem to always appear at the top left corner of the screen on top of each other even though there would be plenty of space elsewhere on the screen.

Revision history for this message
hansvschoot (hansvschoot) wrote :

the smart window placement fails on the second output. if the smart window placement plugin is set to use all output devices, it refuses to do so and only uses the first. changing the output into a single large one (under compiz general settings > display settings) solves this problem but introduces a new one. it will allow smart window placement to spawn on both monitors, but (of course) the border between the two monitors will be gone. this makes maximizing a window spawn both screens, and the smart window placement will split some of the new windows between both screens.

Changed in compiz:
status: New → Confirmed
milestone: none → 0.9.8.0
Revision history for this message
hansvschoot (hansvschoot) wrote :

some more testing:
The random placement mode behaves normal: it uses both outputs when "place across all outputs" is selected, and also works like its supposed to with any other multi output mode.
Smart testing reverts to the top left corner of the second monitor if it is active and "use active output device" is selected for multi output mode. if "place across all outputs" is used, the second monitor is ignored and only the first one is used.

additional info:
this behaviour appears in ubuntu 12.04. older versions (11.10 and before) did not have this bug.

Changed in compiz:
milestone: 0.9.8.0 → 0.9.8.1
Revision history for this message
hansvschoot (hansvschoot) wrote :

so i had some time on my hands and did a bit more testing.
i took a clean ubuntu 12.04 install, ripped out the default compiz (0.9.7.8?) and replaced it with the compiz from onceiric (version 0.9.6).
this results in ubuntu 12.04 with only unity 2D available, in which compiz can be enabled and set up for testing. running compiz 0.9.6 under ubuntu 12.04 solves the problem in the smart window placement routine, but of course breaks a lot of other stuff.

for other people who want to mess around, break their system and test some stuff:
log out, log back in using unity 2D (or classic gnome, or any other manager that does not depend on unity)
in a terminal, remove compiz (and unity): sudo apt-get purge compiz*

I downloaded the .deb files from https://launchpad.net/ubuntu/oneiric/amd64/ (as my version was 64bit)
download the following packages, and install them using sudo dpkg -i package-name-here . the order is important, as they depend on one another
libdecoration0
compiz-core
compiz-plugins-default
compiz-plugins
libcompizconfig0
python-central
python-compizconfig
compizconfig-backend
compizconfig-settings-manager
compiz-gnome
(if they give an error, check the dependencies!)

after this you can test compiz 0.9.6 and ccsm under ubuntu 12.04, by running:
compiz --replace

My guess where things go wrong:
in the source of the compiz package (0.9.7.8 vs 0.9.6) the only real difference in the smart placement routine i can find is at line 83 of smart.ccp (plugins/place/src/smart/src/), where the old version (place.cpp, line 968) adds up 4 variables and the new version adds up only 3.

i'll keep digging, but it might take a lot of time, as i'm not familiar with the structure of the rest of the compiz code.

Changed in compiz:
milestone: 0.9.8.2 → 0.9.8.4
Changed in compiz:
milestone: 0.9.8.4 → 0.9.9.0
Changed in compiz:
milestone: 0.9.9.0 → 0.9.9.2
Changed in compiz:
milestone: 0.9.9.2 → 0.9.10.0
MC Return (mc-return)
Changed in compiz:
importance: Undecided → Medium
assignee: nobody → MC Return (mc-return)
MC Return (mc-return)
Changed in compiz:
milestone: 0.9.10.0 → 0.9.11.0
tags: added: multi-monitor
Revision history for this message
fcole90 (fcole90) wrote :

As part of the big bug review for 16.04 LTS I have tested this on 15.10 and the bug is still there. I think this is a feature request rather than a bug.

Changed in compiz (Ubuntu):
status: Confirmed → Opinion
Changed in compiz:
status: Confirmed → Opinion
Changed in compiz:
status: Opinion → Confirmed
Changed in compiz (Ubuntu):
status: Opinion → Confirmed
Changed in compiz:
status: Confirmed → Invalid
Changed in compiz (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

This is not a bug. The same problem occurs in every DE because opencv's imshow gives the windows the same default position. If you use cv::moveWindow you can change the window position in imshow... If you think this shouldn't happen you should fill a bug report in python-opencv.

Changed in compiz:
importance: Medium → Low
Changed in compiz (Ubuntu):
importance: Undecided → Low
Revision history for this message
Ronan Le Hy (rlehy) wrote :

Re #8: "This is not a bug. The same problem occurs in every DE"

Cool theory! Did you try? (I did when I filed the bug, and I did again just now (on 15.04): OpenBox, Gnome and LXDE open these windows without any overlapping.)

Revision history for this message
Nathaniel W. Turner (nturner) wrote :

@Fabio, if this feature didn't exist and we were asking for it, that would be a feature request. The feature exists, but does not work. That is a bug.

@Eleni, I think you must be confusing this with a different bug report.

Changed in compiz:
status: Invalid → Confirmed
Changed in compiz (Ubuntu):
status: Invalid → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.