Re: [Maybe OT]: Sawfish 'strange' behaviours



On Sat, 2001-12-08 at 01:49, Havoc Pennington wrote:

rob <mailingLists pangolin org uk> writes:  
It's what every other app dose (and it's what you said to do in the GGAD
book). 

Sure, but I was wrong. ;-) At least according to the ICCCM.

Reading the ICCCM it seems to do what you'd expect: the class bit
specifies some set of windows that should be considered a group and type
is used to differentiate between windows of the same class.(btw i
couldn't find where it said that class and type should be the same all I
could find was section 4.2.1.5 on the WM_CLASS)

What 4.1.2.5 says is that the name should identify an application
instance, not a window type. It also specifies that you should use the
following algorithm to set the class name:

 - the -name command line arg
 - else RESOURCE_NAME env variable
 - else the trailing part of argv[0]

from the icccm the type field is 

   *  A string that names the particular instance of the application to
which the client that owns this window belongs.

your quite right. I apologise. 

to sum up

class is used to specifie a group of related applications.

type is used to indetify the application instance that a window belongs
to
        this can be done by the user by using -name etc
        this can be overiden by the application writer

By default all application instances are set to the same type (argv[0])
(this of course means that differnt apps have differnt types it's just
the instances that have the same type).
This to me seems to defeat the purpose of setting the instance type
(which I would assume is so that the user can tell apart the same window
in different instances because the wm has decorated them differntly).

setting the type in the app gusumps anything the user specified

role is used to uniquely identify a window i.e enableiny the wm to tell
the difference between the same window belonging to differnt instances
or, differnt windows (with the same title) within a single instance.

the windows title is used to identify what type of window it is e.g open
dialog.

What the window manager and related things do with this info is
completly up to them.

What you would expect is: 

Application instances of the same class are somehow visually similar e.g
all have a red border or stacked on the panel 

Differnt instances within the class are somehow visually unique e.g are
differnt shades of red(this applies to all windows of the instance). 

Windows with different roles are somehow visually unique e.g have a
differnt colour border inside the red one. 
And most importantly the window manager will remeber there geometries so
it can position and size windows of the application instance correctly
when the session is restarted.(However this can't be used to create a
new instance of a window the correct size as each window is unique). 

The windows title is used by the window manager to decide the default
size for the window (i.e the same size as the last window of that type).

All this depends on how the user has set up the wm, the task bar, and
any other related apps.

So the application should:

set the class only if the default class isn't suitable (the default
class being argv[0]) which will only be unsuitable if you want your app
to belong some suite rather than have a class of it's own. Unfortunatly
you have to set both the class and the type together so you need to
retrive the type from the window and reset it when you set the class.

set the type only if the default type isn't suitable unfortunatly the
spec says that argv[0] should be the default type which makes no sense
so you probably want to stick a unique string on the end of it. Again
the type and class have to be set together.

set the role if the default role isn't suitable. which it wont be unless
you have an app with only 1 window that cannot have multilpe instances
running. Using the instance type with a unique string seems sensible.

*Not* set the title of the window to things like 'MyApp: Document1'
because the wm wont know that a window called 'MyApp: Document2' shold
have the same default size as it.

pray

Hopefully now I understand.

If nothing else perhaps I've encouraged ximian to work harder on making
a gnome-spell binary for potatoe 

-- 

rob




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]