On 3/15/10, Shawn Betts <[email protected]> wrote:
> 2010/3/15 Eric A <[email protected]>:
>> On Sun, Mar 14, 2010 at 5:09 AM, tomm smith <[email protected]> wrote:
>>> I believe I have created a patch for this desired hook. Only had to
>>> change a few lines, basically define the hook and add a hook call to
>>> new_window(). I am a newborn in the C world so if any of this is
>>> hackery that does not comply with GNU coding standards I do apologize.
>>> I have attached the patch to this email. I tested out the code very
>>> shortly I plan to test it more, but initial test showed everything was
>>> working smoothly.
>>>
>>
>> Thanks, I think this is what I'm looking for! I tried it out, but ran
>> into a problem. It seems that for most programs,
>> new_window(XCreateWindowEvent *e) is called multiple times. For
>> example, starting midori issues 2 events and firefox 3 events. In
>> fact, the only program that I've tested that calls it just once is
>> urxvt.
>
> The hook should be called when the window is mapped, not when it is
> created. Applications create a bunch of windows at start up that
> you're not interested in. It's a quirk of ratpoison that it keeps
> track of all created windows instead of simply waiting for a map
> request.
>
> -Shawn
>
>
> _______________________________________________
> Ratpoison-devel mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/ratpoison-devel.
>

I take it this is more of an issue with following the function of the
code? So in case RP is changed to not track created windows, it then
doesnt break the hook? because it was working as expected with the
position it was in. I did some more digging and looked into
map_request() this works correctly.
Only in ratdev/src: config.h
Only in ratdev/src: config.h.in
Only in ratdev/src: .deps
diff -crB ratorig/src/events.c ratdev/src/events.c
*** ratorig/src/events.c	2010-03-13 21:43:43.000000000 -0500
--- ratdev/src/events.c	2010-03-16 00:35:34.000000000 -0400
***************
*** 103,108 ****
--- 103,109 ----
        win = add_to_window_list (s, e->window);
        update_window_information (win);
      }
+ 	
  }
  
  static void
***************
*** 204,209 ****
--- 206,214 ----
          }
        break;
      }
+ 
+ 		// window map requested so run our new window hook
+ 		hook_run (&rp_new_window_hook);
  }
  
  static void
diff -crB ratorig/src/globals.c ratdev/src/globals.c
*** ratorig/src/globals.c	2010-03-13 21:43:43.000000000 -0500
--- ratdev/src/globals.c	2010-03-13 21:46:29.000000000 -0500
***************
*** 231,236 ****
--- 231,237 ----
  LIST_HEAD (rp_quit_hook);
  LIST_HEAD (rp_restart_hook);
  LIST_HEAD (rp_delete_window_hook);
+ LIST_HEAD (rp_new_window_hook);
  
  struct rp_hook_db_entry rp_hook_db[]=
    {{"key",              &rp_key_hook},
***************
*** 241,246 ****
--- 242,248 ----
     {"deletewindow",     &rp_delete_window_hook},
     {"quit",             &rp_quit_hook},
     {"restart",          &rp_restart_hook},
+ 	 {"createwin",				&rp_new_window_hook},
     {NULL, NULL}};
  
  void
diff -crB ratorig/src/globals.h ratdev/src/globals.h
*** ratorig/src/globals.h	2010-03-13 21:43:43.000000000 -0500
--- ratdev/src/globals.h	2010-03-13 21:46:42.000000000 -0500
***************
*** 181,186 ****
--- 181,187 ----
  extern struct list_head rp_delete_window_hook;
  extern struct list_head rp_quit_hook;
  extern struct list_head rp_restart_hook;
+ extern struct list_head rp_new_window_hook;
  
  extern struct rp_hook_db_entry rp_hook_db[];
  
Only in ratdev/src: Makefile
Only in ratdev/src: Makefile.in
Only in ratdev/src: stamp-h1
diff -crB ratorig/src/window.c ratdev/src/window.c
*** ratorig/src/window.c	2010-03-13 21:43:43.000000000 -0500
--- ratdev/src/window.c	2010-03-16 00:17:15.000000000 -0400
***************
*** 1,4 ****
! /* functions for handling the window list
   * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <[email protected]>
   *
   * This file is part of ratpoison.
--- 1,4 ----
! /* FUnctions for handling the window list
   * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <[email protected]>
   *
   * This file is part of ratpoison.
_______________________________________________
Ratpoison-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/ratpoison-devel

Reply via email to