LWJGL
May 18, 2013, 01:32:38 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1] 2
  Print  
Author Topic: Window Icon  (Read 7019 times)
psiegel
Talks Too Much
***
Posts: 109



« on: July 10, 2003, 05:42:33 »

Is there any way to set the window icon to something other than the default?  I mean the one that appears in the top left corner of the window's title bar, and in the task bar.  

If not, can I put in a feature request for that?

Paul
Logged
princec
Nerdus Imperius
*****
Posts: 1867



WWW
« Reply #1 on: July 10, 2003, 05:49:43 »

Good idea.

Cas Smiley
Logged

tomb
Talks Too Much
***
Posts: 148


« Reply #2 on: April 13, 2005, 17:19:18 »

Been awhile since this was requested :cry:

I've taken the liberty to implement this on windows. MacOS port is trivial as it uses awt. I leave it up to someone else to do the linux port.

Anyway, it seems I've gotten this to work on windows. Windows has 2 icon sizes. The big icon is used when alt-tabbing between application, the smal icon is used in the frame caption, and the taskbar. I've added 2 functions: setSmallWindowIcon and setBigWindowIcon. I'd like to keep the 2 functions even if they are not used on Mac or linux. Is more professional than haveing one of the icons scaled.

There is no need for a getMin/MaxSize, as windows and awt will accept icons of any size. It is better to have getRecommendedSmallIconSize and getRecommendedBigIconSize functions to allow the lwjgl application to privede the icons that has the closest fit.

I can post the code here in the forum or I could mail it to someone with cvs access. I don't want to commit to cvs directly as it will take me too long to set up. It would be a good idee if someone that knows windows/c programming has a look at the code, as I'm sure it has bunch of resource leaks in it :oops:
Logged
Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #3 on: April 14, 2005, 07:51:30 »

awesome!
send it to info@lwjgl.org and I'll take a look at it. We might refactor the code as needed though.
Logged

tomb
Talks Too Much
***
Posts: 148


« Reply #4 on: April 14, 2005, 16:25:47 »

Quote from: "Matzon"
awesome!
send it to info@lwjgl.org and I'll take a look at it. We might refactor the code as needed though.

Sure, do what you like with it. The code is in the mail.
Logged
elias4444
Nerdus Imperius
*****
Posts: 636



WWW
« Reply #5 on: April 15, 2005, 08:03:12 »

If the Mac port is trivial because it uses awt, would the Linux port also not be trivial? Or am I missing something here?

BTW, great job on the Windows icon!  Smiley
Logged

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com
tomb
Talks Too Much
***
Posts: 148


« Reply #6 on: April 15, 2005, 09:17:13 »

I think linux does all it's own window managment, and do not use awt.
Logged
princec
Nerdus Imperius
*****
Posts: 1867



WWW
« Reply #7 on: April 15, 2005, 11:58:15 »

I think Elias has rewritten it all to use AWT now on Linux.

Cas Smiley
Logged

tomb
Talks Too Much
***
Posts: 148


« Reply #8 on: April 15, 2005, 13:06:14 »

Did not know about that. I just looked at the 0.96 source.

In that case the linux port will be trivial as well.
Logged
elias
Nerdus Imperius
*****
Posts: 899



WWW
« Reply #9 on: June 01, 2005, 00:32:09 »

Ah, no. Linux Display uses AWT locking to synchronize with AWT because X11 is not multithread safe. The rest of the code is still custom X11 (except AWTGLCanvas support of course)

 - elias
Logged

kevglass
Guest
« Reply #10 on: June 02, 2005, 08:11:24 »

I was going to look at doing the linux version, but we need to decide on the API. Since each of the platforms require different size icons (16x16 and 24x24 for windows, 16x16 upwards for linux, and preferably huge for MacOS) we need something beautifully generic.

A suggestions:
Code:

public class Display {
     public static final int ICON_16 = 1;
     public static final int ICON_24 = 2;
     public static final int ICON_32 = 3;
     public static final int ICON_64 = 4;
     public static final int ICON_128 = 5;

     public static void setIcon(int type,ByteBuffer data) {
             // each Display implementation decides whether it wants to use
             // this icon size or not, if not the default or previously set icon is
             // maintained

             // assumed RGBA8 - if not the implementation is responsible
             // for filtering
     }
}


Kev
Logged
Matzon
Administrator
Demigod
*****
Posts: 2237



« Reply #11 on: June 02, 2005, 08:21:39 »

Why the type then? - if the data is RGBA8 then just check the size of the passed buffer?
Logged

kevglass
Guest
« Reply #12 on: June 02, 2005, 08:25:10 »

I was thinking it let people who were using it know what sizes it would be good to provide. But yeah, I see your point.. maybe the javadoc could say enough?

Kev
Logged
kevglass
Guest
« Reply #13 on: June 06, 2005, 10:51:14 »

So, what ya reckon? On IRC we've talked about some sort of wrapped object (org.lwjgl.Image?) that holds the byte buffer, validates it and handles conversions for platform specifics.

I've got linux code that seems to work now, so we just need an API Smiley

Kev
Logged
tomb
Talks Too Much
***
Posts: 148


« Reply #14 on: June 06, 2005, 12:18:27 »

Lets recap how icons are handled on the different systems and try to come up with a sensible api that enables all the available features, but keeps the api simple.

On windows there are:
-BigIcon, size 32x32, used when alt-tabbing between apps.
-SmalIcon, size 16x16, used in window titlebar and taskbar.
The image used can be of any reasonable size (think there is limit around 4096*4096). The image will be scaled with bilinear filtering to 32x32 or 16x16 by windows. Only tested on windows xp. Don't know if other icons sizes are in use on other windows version/setup.

MacOs:
Because it uses AWT only one icon can be used threw setIconImage(Image image). I assume that the image will be resized by awt to the prefered size on MacOS. Can anyone try to find out what the prefered size of the icon is on MacOS?

Can you give a description of how icons works on linux, kevglass?

I don't see the need for a org.lwjgl.Image class. Just document that the pixels need to be tighly packed and format of the pixel (ARGB or RGBA). Width and height are passed in as arguments to the functions.
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!