You are not logged in.

#1 2012-10-24 14:05:11

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

[Solved] "Photo" not obeying dwm's rules

Hello archers,
  I am using this image viewer called "Photo". Everything is working fine except the program window is not obeying dwm hints. Every Time when I invoke it , it opens with a really small window in floating mode. Pressing Mod+m (monocle mode) also does not have any effect. I need to drag it every time to make it bigger.
  I think it is something related to EWMH standards but I don't know exactly. So what should I do ? Is it something dwm specific or the program is ignoring the hints.
  I have centered floating , save floats, attachaside and some other layout patches applied . If that makes any difference .

Last edited by illusionist (2012-10-24 16:12:13)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#2 2012-10-24 14:20:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [Solved] "Photo" not obeying dwm's rules

I just tried it ... it certainly does a lot of very odd things with it's windows.  But in another tiling manager it is properly tiled.

Photo doesn't seem to actually draw it's window's background, so it looks transparent, except what is behind it is whatever window used to  be there - even if that window has now moved (due to retiling).

I noted that it starts up with the NET_WM_STATE atom set to _NET_WM_STATE_FULLSCREEN.  I know dwm honors these atoms.  The tiler I'm using ignores them.  So I suspect dwm is fullscreening the window when it starts, but since photo doesn't redraw it's window background, all you see are a couple of it's subwindows - 1 for the selected image, and 1 for an information box.

Last edited by Trilby (2012-10-24 14:24:27)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-10-24 14:50:25

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

You are right. It surely does something odd to make the background transparent. I noticed it flashes fullscreen only for a second or so captures the background then goes into floating mode ( or whatever). So what do you suggest trilby ? Is there anything I can do with dwm or contact the author or leave it as it is.

Also which tiler are you using ?


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#4 2012-10-24 15:02:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [Solved] "Photo" not obeying dwm's rules

I'm using my own homemade tiler (in sig).  Feel free to try it out, but it is pretty basic and lacking many features (and layouts) you may be used to in dwm.

If you really want to tackle this, I think it would be easier to modify dwm than to modify photo - I looked briefly at the code for photo ... there's a lot of it.

I never really explored dwm's window rules that well (ie when you have certain actions applied to certain applications), but this is where I'd start.  You could write a very short custom function to run when photo is launched/mapped.  This function would only have to set up for and do one thing: call XChangeProperty on the photo window

Alternately, it'd be much easier to modify dwm to ignore all FULLSCREEN hints, but this would have side effects on other applications that use that hint/atom in more sane ways.

edit: This function already exists in dwm - it's the setfullscreen function.  One thing you'd have to look into, though, is the order in which rules are processed.  You'd want to disable the fullscreen setting after dwm has already read the windows original hints.

BTW, do you have the setfullscreen function in dwm.c?  I don't remember if this was a patch I applied or original material.  If you have it, and you have a key bound to it, can you start photo and "unfullscreen" it to get it properly tiled?

Last edited by Trilby (2012-10-24 15:11:01)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2012-10-24 15:23:27

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

Whoa... I am not a coder myself (haven't done anything like that since college) but i got what you said . I need to look through some documentations out there and recall my programming classes. I guess it is the time to be productive. At least I know what to look for.

EDIT: I need to look into dwm to see that .

EDIT 2: I do have setfullscreen function in my dwm.c . Checking now to see if your solution woks....

Last edited by illusionist (2012-10-24 15:30:01)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#6 2012-10-24 15:40:37

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: [Solved] "Photo" not obeying dwm's rules


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#7 2012-10-24 15:48:07

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

Is this what I supposed to do ?

{ MODKEY|ShiftMask,                     XK_m,                   setfullscreen,          {0} },

and when I launch photo, mod+shift+m. Then relaunch but no effect.

EDIT: Seeing your  link Unia.....

Last edited by illusionist (2012-10-24 15:49:52)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#8 2012-10-24 15:49:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [Solved] "Photo" not obeying dwm's rules

setfullscreen only works for the currently running client.  It would not carry over to the next launch of that program.

But when you start photo, then hit mod+shift+m does the window 'behave' better?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2012-10-24 15:51:06

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

No nothing happens.
Seeing the patch at  the link unia gave


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#10 2012-10-24 15:59:15

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [Solved] "Photo" not obeying dwm's rules

I just fired up dwm and tried this out again.  unfullscreening it failed for me too - I was wrong, it is not treated as fullscreen, even though it sets that WMHint.  It just acts like a small floating window.

But the mouse bind for "togglefloating" did successfully put it back into tiling mode.

	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },

Have you tried a window rule with 'togglefloating'? nevermind, window rules don't call functions.

Last edited by Trilby (2012-10-24 16:00:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2012-10-24 16:04:58

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

@Unia

The patch you mentioned is somewhat working. Every time I launch photo , I need to call that function to maximize the window but it is maximizing to the lower left corner of my screen.
I can bind a key to call that function when i launch photo ( I am ok with it). But now the only thing is how to move that window to the center of my screen automatically ?

Edit: Done ! it was my fault in config.h . I had always float property set for Photo's window. The issue is resolved now. The patch unia mentioned worked .
Thank you very much to trilby and unia for helping me with this issue. You guys were so fast in helping . Marking this thread as solved now.

Last edited by illusionist (2012-10-24 16:11:18)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#12 2012-10-24 16:12:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,554
Website

Re: [Solved] "Photo" not obeying dwm's rules

Doh, I just found a single line patch to dwm.c that would remedy this ... oh well, it is always fun exploring WM code.

It's quite task-specific, but a single line in manage()

        configure(c); /* propagates border_width, if size doesn't change */
        updatewindowtype(c);
        updatesizehints(c);
        updatewmhints(c);
+       if ( strncmp(c->name,"photo",5)==0 ) c->isfloating=False;
        XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
        grabbuttons(c, False);

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2012-10-24 16:22:10

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

Re: [Solved] "Photo" not obeying dwm's rules

@Trilby
LOL.... big_smile big_smile

Damn... That was funny as hell man ! big_smile


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

Board footer

Powered by FluxBB