← Back to team overview

dx-packages team mailing list archive

[Bug 1459671] Re: focus goes to the wrong window after a modal dialog is closed

 

I decided to investigate this problem and checked out the source code.
After a lot of debugging I found out that the call to focus the wrong
window is coming from compiz CompScreenImpl::focusDefaultWindow which
comes from this code on compiz event.cpp :

		else if (event->xfocus.window == privateScreen.rootWindow())
		{
		    /* Don't ever let the focus go to the root
		     * window except in grab cases
		     *
		     * FIXME: There might be a case where we have to
		     * handle root windows of other screens here, but
		     * the other window managers should handle that
		     */

		    if (event->xfocus.detail == NotifyDetailNone ||
			(event->xfocus.mode == NotifyNormal &&
			 event->xfocus.detail == NotifyInferior))
		    {
			privateScreen.orphanData.activeWindow = None;

			if (event->xfocus.detail == NotifyDetailNone ||
			    (event->xfocus.mode == NotifyNormal &&
			     event->xfocus.detail == NotifyInferior))
			{
			    screen->focusDefaultWindow ();
			}
		    }
		}

The FIXME comment is very suspicious but I have no idea what would be the solution.
I'm adding an attachment file with the stacktrace.

-- 
You received this bug notification because you are a member of DX
Packages, which is subscribed to unity in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/1459671

Title:
  focus goes to the wrong window after a modal dialog is closed

Status in Unity:
  Confirmed
Status in unity package in Ubuntu:
  Confirmed

Bug description:
  Steps to reproduce on Ubuntu 15.04:

  1 - Install eclipse with "apt-get install eclipse"
  2 - Start eclipse
  3 - Create a new project
  4 - Create a file in the newly created project
  5 - Detach any view (the task view , for example)
  6 - Open the created file, or just focus on its editor
  7 - Open any modal dialog (resources dialog for example (ctrl + shift + r))
  8 - Close the dialog (ESC)

  Expected:
  - Focus goes back to the main window.

  What happens:
  - Focus goes to the detached view.

  I think this is a unity bug because I did the same test under Fedora 22 (Gnome 3), Lubuntu and Kubuntu and all of them presented the expected behaviour.
  Also, while I was editing some screenshots using gimp in multi window mode, something even stranger happened:
  After doing step 8 on eclipse, the focus  did not even go to eclipse, it went to one of the gimp windows.

  Also I tried to disable all compiz plugins that unity does not depend
  on, but the behaviour kept the same.

  ProblemType: Bug
  DistroRelease: Ubuntu 15.04
  Package: unity 7.3.2+15.04.20150420-0ubuntu1
  ProcVersionSignature: Ubuntu 3.19.0-18.18-generic 3.19.6
  Uname: Linux 3.19.0-18-generic x86_64
  .tmp.unity.support.test.0:
   
  ApportVersion: 2.17.2-0ubuntu1.1
  Architecture: amd64
  CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
  CompositorRunning: compiz
  CompositorUnredirectDriverBlacklist: '(nouveau|Intel).*Mesa 8.0'
  CompositorUnredirectFSW: true
  CurrentDesktop: Unity
  Date: Thu May 28 10:14:49 2015
  DistUpgraded: 2015-05-07 19:41:01,746 DEBUG enabling apt cron job
  DistroCodename: vivid
  DistroVariant: ubuntu
  DkmsStatus:
   virtualbox, 4.3.26, 3.19.0-16-generic, x86_64: installed
   virtualbox, 4.3.26, 3.19.0-18-generic, x86_64: installed
  GraphicsCard:
   Advanced Micro Devices, Inc. [AMD/ATI] Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM] [1002:6779] (prog-if 00 [VGA controller])
     Subsystem: Dell Radeon HD 6450 [1028:2120]
  InstallationDate: Installed on 2015-05-07 (20 days ago)
  InstallationMedia: Ubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
  MachineType: Dell Inc. OptiPlex 7010
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.19.0-18-generic root=UUID=3394eb7d-5a46-4d1f-8f22-dadec1c23bc8 ro quiet splash vt.handoff=7
  SourcePackage: unity
  UpgradeStatus: Upgraded to vivid on 2015-05-07 (20 days ago)
  dmi.bios.date: 06/10/2013
  dmi.bios.vendor: Dell Inc.
  dmi.bios.version: A14
  dmi.board.name: 0XJT3J
  dmi.board.vendor: Dell Inc.
  dmi.board.version: A00
  dmi.chassis.type: 6
  dmi.chassis.vendor: Dell Inc.
  dmi.modalias: dmi:bvnDellInc.:bvrA14:bd06/10/2013:svnDellInc.:pnOptiPlex7010:pvr01:rvnDellInc.:rn0XJT3J:rvrA00:cvnDellInc.:ct6:cvr:
  dmi.product.name: OptiPlex 7010
  dmi.product.version: 01
  dmi.sys.vendor: Dell Inc.
  version.compiz: compiz 1:0.9.12.1+15.04.20150410.1-0ubuntu1
  version.ia32-libs: ia32-libs N/A
  version.libdrm2: libdrm2 2.4.60-2
  version.libgl1-mesa-dri: libgl1-mesa-dri 10.5.2-0ubuntu1
  version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
  version.libgl1-mesa-glx: libgl1-mesa-glx 10.5.2-0ubuntu1
  version.xserver-xorg-core: xserver-xorg-core 2:1.17.1-0ubuntu3
  version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.9.0-1ubuntu2
  version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:7.5.0-1ubuntu2
  version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917-1~exp1ubuntu2.1
  version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.11-1ubuntu2build1
  xserver.bootTime: Thu May 28 08:47:13 2015
  xserver.configfile: default
  xserver.errors:
   
  xserver.logfile: /var/log/Xorg.0.log
  xserver.version: 2:1.17.1-0ubuntu3
  xserver.video_driver: radeon

To manage notifications about this bug go to:
https://bugs.launchpad.net/unity/+bug/1459671/+subscriptions


References