Compiz Application Switcher (ALT-Tab) does just use high res icons when provided by .desktop file

Bug #1104511 reported by Felix Möller
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Compiz
Invalid
Undecided
Unassigned
Unity
Fix Released
Undecided
Unassigned
compiz (Ubuntu)
Invalid
Undecided
Unassigned
unity (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I am trying to set a high resolution for a Java based application (https://www.willuhn.de/bugzilla/show_bug.cgi?id=1310).

This application uses SWT which uses the GTK function gtk_window_set_icon() to set an icon for the application.

However, no matter of the resolution I pass there the ALT-Tab switcher uses a bad icon.

This has been reported as well for Python (http://askubuntu.com/questions/90845/pygtk-application-icon-blurred-in-unity) and reported in the forums (http://ubuntuforums.org/showthread.php?t=2053292).

I tried to get more insights at http://askubuntu.com/questions/245875/how-do-i-get-high-resolution-icons-in-unity-for-my-application-without-a-deskto.

The following Java code shows the problem:
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Test {
  public static void main(String[] args) {
    Display display = new Display();

    final int SIZE = 256;
    Image large = new Image(display, SIZE, SIZE);
    GC gc = new GC(large);
    gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
    gc.fillArc(0, 0, SIZE, SIZE, 45, 270);
    gc.dispose();

    Shell shell = new Shell(display);
    shell.setImages(new Image[] { large });

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }

    large.dispose();
    display.dispose();
  }
}

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: compiz 1:0.9.9~daily13.01.21-0ubuntu1
ProcVersionSignature: Ubuntu 3.8.0-1.5-generic 3.8.0-rc4
Uname: Linux 3.8.0-1-generic x86_64
.tmp.unity.support.test.0:

ApportVersion: 2.8-0ubuntu2
Architecture: amd64
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
CompositorRunning: compiz
Date: Thu Jan 24 23:10:03 2013
DistUpgraded: 2013-01-23 07:16:01,014 DEBUG enabling apt cron job
DistroCodename: raring
DistroVariant: ubuntu
DkmsStatus:
 tp-smapi, 0.41, 3.5.0-22-generic, x86_64: installed
 tp-smapi, 0.41, 3.8.0-1-generic, x86_64: installed
 virtualbox, 4.1.22, 3.5.0-22-generic, x86_64: installed
 virtualbox, 4.1.22, 3.8.0-1-generic, x86_64: installed
GraphicsCard:
 Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller [8086:2a42] (rev 07) (prog-if 00 [VGA controller])
   Subsystem: Lenovo Device [17aa:20e4]
   Subsystem: Lenovo Device [17aa:20e4]
InstallationDate: Installed on 2012-03-31 (299 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Beta amd64 (20120331)
MachineType: LENOVO 6474A46
MarkForUpload: True
PackageArchitecture: all
PccardctlIdent:
 Socket 0:
   no product info available
PccardctlStatus:
 Socket 0:
   no card
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.8.0-1-generic root=UUID=b32d85c9-d1fb-49ca-8c94-c64d321221b3 ro quiet splash vt.handoff=7
SourcePackage: compiz
UpgradeStatus: Upgraded to raring on 2013-01-23 (1 days ago)
dmi.bios.date: 10/17/2012
dmi.bios.vendor: LENOVO
dmi.bios.version: 7UET94WW (3.24 )
dmi.board.name: 6474A46
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr7UET94WW(3.24):bd10/17/2012:svnLENOVO:pn6474A46:pvrThinkPadT400:rvnLENOVO:rn6474A46:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 6474A46
dmi.product.version: ThinkPad T400
dmi.sys.vendor: LENOVO
version.compiz: compiz 1:0.9.9~daily13.01.21-0ubuntu1
version.ia32-libs: ia32-libs 20090808ubuntu36
version.libdrm2: libdrm2 2.4.41-0ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 9.0.2-0ubuntu1
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 9.0.2-0ubuntu1
version.xserver-xorg-core: xserver-xorg-core 2:1.13.1.901-0ubuntu2
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.7.3-0ubuntu2
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:7.0.0-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.20.19-0ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.6-0ubuntu1
xserver.bootTime: Thu Jan 24 22:57:21 2013
xserver.configfile: default
xserver.errors:

xserver.logfile: /var/log/Xorg.0.log
xserver.version: 2:1.13.1.901-0ubuntu2
xserver.video_driver: intel

Revision history for this message
Felix Möller (felix-derklecks) wrote :
Revision history for this message
Felix Möller (felix-derklecks) wrote :

Screenshot showing the bad resolution of the icon rendered with 256px.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

This is not a compiz bug.

My understanding is that unity/bamf get their icon from the .desktop file and not the WM_ICON property. I've subscribed unity to get more info on that.

Changed in compiz (Ubuntu):
status: New → Invalid
Changed in compiz:
status: New → Invalid
Changed in unity:
status: New → Incomplete
status: Incomplete → New
Revision history for this message
Felix Möller (felix-derklecks) wrote :

Thanks for the quick response Sam.

Yes it seems that something in the stack reads only from the .desktop file. However for applications such as a java application which is downloaded in place and not coming from the repos I think the .desktop file is not viable.

gtk_window_set_icon_list() supports multiple resolutions, so the best one should be used for the switcher.

Revision history for this message
Felix Möller (felix-derklecks) wrote :

@Sam: Is the code for the default switcher at http://bazaar.launchpad.net/~compiz-team/compiz/0.9.9/files/head:/plugins/switcher ? Or what is used here?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Re: [Bug 1104511] Re: Compiz Application Switcher (ALT-Tab) does just use high res icons when provided by .desktop file
Download full text (6.0 KiB)

Depends.

If you're using unity, the switcher is in unity itself and uses the
same code as the launcher to render the icons. See
unity/launcher/BamfLauncherIcon.cpp

If you're using compiz without unity, it would be staticswitcher,
which is really just using the same code from compiztoolbox
(compiz/plugins/compiztoolbox/src/compiztoolbox.cpp)

On Wed, Jan 30, 2013 at 6:13 AM, Felix Möller <email address hidden> wrote:
> @Sam: Is the code for the default switcher at
> http://bazaar.launchpad.net/~compiz-
> team/compiz/0.9.9/files/head:/plugins/switcher ? Or what is used here?
>
> --
> You received this bug notification because you are a member of Compiz
> Maintainers, which is subscribed to compiz in Ubuntu.
> Matching subscriptions: Compiz Maintainers ubuntu compiz
> https://bugs.launchpad.net/bugs/1104511
>
> Title:
> Compiz Application Switcher (ALT-Tab) does just use high res icons
> when provided by .desktop file
>
> Status in Compiz:
> Invalid
> Status in Unity:
> New
> Status in “compiz” package in Ubuntu:
> Invalid
>
> Bug description:
> I am trying to set a high resolution for a Java based application
> (https://www.willuhn.de/bugzilla/show_bug.cgi?id=1310).
>
> This application uses SWT which uses the GTK function
> gtk_window_set_icon() to set an icon for the application.
>
> However, no matter of the resolution I pass there the ALT-Tab switcher
> uses a bad icon.
>
> This has been reported as well for Python
> (http://askubuntu.com/questions/90845/pygtk-application-icon-blurred-
> in-unity) and reported in the forums
> (http://ubuntuforums.org/showthread.php?t=2053292).
>
> I tried to get more insights at http://askubuntu.com/questions/245875
> /how-do-i-get-high-resolution-icons-in-unity-for-my-application-
> without-a-deskto.
>
> The following Java code shows the problem:
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.graphics.GC;
> import org.eclipse.swt.graphics.Image;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> public class Test {
> public static void main(String[] args) {
> Display display = new Display();
>
> final int SIZE = 256;
> Image large = new Image(display, SIZE, SIZE);
> GC gc = new GC(large);
> gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
> gc.fillArc(0, 0, SIZE, SIZE, 45, 270);
> gc.dispose();
>
> Shell shell = new Shell(display);
> shell.setImages(new Image[] { large });
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
>
> large.dispose();
> display.dispose();
> }
> }
>
> ProblemType: Bug
> DistroRelease: Ubuntu 13.04
> Package: compiz 1:0.9.9~daily13.01.21-0ubuntu1
> ProcVersionSignature: Ubuntu 3.8.0-1.5-generic 3.8.0-rc4
> Uname: Linux 3.8.0-1-generic x86_64
> .tmp.unity.support.test.0:
>
> ApportVersion: 2.8-0ubuntu2
> Architecture: amd64
> CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
> CompositorRunning: compiz
> Date: Thu Jan 24 23:10:03 2013
> DistUpgraded: 2013-...

Read more...

Revision history for this message
Felix Möller (felix-derklecks) wrote :

Looking at the source I think the unity class has been renamed:

revno: 2806 [merge]
author: Tim Penhey <email address hidden>
committer: Tarmac
branch nick: unity
timestamp: Fri 2012-10-05 07:05:34 -0400
message:
  Rename BamfLauncherIcon to ApplicationLauncherIcon.. Fixes: . Approved by Nick Dedekind, Thomi Richards.

Scrolling through the source it looks as if in line 937 the icon size is hard coded:
void ApplicationLauncherIcon::UpdateIconGeometries(std::vector<nux::Point3> center)
{
  nux::Geometry geo;
  geo.width = 48;
  geo.height = 48;

  for (auto& window : app_->GetWindows())
  {

however, i do not understand enough of the code to continue there.

Revision history for this message
Felix Möller (felix-derklecks) wrote :

This is fixed in saucy.

Changed in unity:
status: New → Fix Committed
Stephen M. Webb (bregma)
Changed in unity:
status: Fix Committed → Fix Released
Changed in unity (Ubuntu):
status: New → Fix Released
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.