On 02/24/2007 23:05, Ravenlock wrote:
On 02/24/2007 17:27, Sebastian Dransfeld wrote:
If pinned is actually just a combination of three other states, why not just make an action which triggers these states and not add a lot of duplicate code?

Sebastian

[Sorry if this double posts.  Sent originally from wrong e-mail address]

Attached is a modified patch which addresses Sebastian's concerns (I hope).

Thanks for pointing it out. :)


OK.  Per discussions on irc... I have attempted to address some concerns.

 - I cleaned up the code a tad.
 - removed the pinned_to_desktop state of the border.
 - No config panel changes whatsoever

I have attached two patches. One that does the above, and a second which will add an action to the keybindings dialog to allow a user to create a binding to toggle the... uh... no longer existing state. Well, again, it just seems convenient. I realize this may not be desired, hence the separate patch.

The 'cleanup' patch is more on the necessary side. The action is just for convenience (as are most actions I think).

-Ravenlock


Ravenlock wrote:
Hello,

Attached is a patch which will allow a user to have borders remember their pinned state. Additionally, an action has been added to the keybindings that allows a user to toggle this state via the keyboard.







------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------

_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


--
Regards,
Ravenlock
Index: e17/apps/e/src/bin/e_actions.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_actions.c,v
retrieving revision 1.90
diff -u -r1.90 e_actions.c
--- e17/apps/e/src/bin/e_actions.c      10 Feb 2007 17:23:05 -0000      1.90
+++ e17/apps/e/src/bin/e_actions.c      27 Feb 2007 06:23:26 -0000
@@ -617,6 +617,27 @@
      }
 }
 
+ /***************************************************************************/
+ACT_FN_GO(window_pinned_toggle) 
+{ 
+   if ((!obj) || (obj->type != E_BORDER_TYPE)) obj = 
E_OBJECT(e_border_focused_get()); 
+   if (!obj) return; 
+   if (!((E_Border *)obj)->lock_border) 
+     {
+               E_Border *bd; 
+       
+       bd = (E_Border *)obj;
+
+       if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) && 
+             (bd->user_skip_winlist) && 
+             (bd->borderless))
+               e_border_pinned_set(bd, 0);
+       else
+               e_border_pinned_set(bd, 1);
+     } 
+}
+               
+
 /***************************************************************************/
 ACT_FN_GO(window_move_by)
 {
@@ -1949,7 +1970,12 @@
    ACT_GO(window_borderless_toggle);
    e_action_predef_name_set(_("Window : State"), _("Toggle Borderless State"),
         "window_borderless_toggle", NULL, NULL, 0);
-   
+  
+   /* window_pinned_toggle */
+   ACT_GO(window_pinned_toggle);
+   e_action_predef_name_set(_("Window : State"), _("Toggle Pinned State"),
+          "window_pinned_toggle", NULL, NULL, 0);
+
    /* desk_flip_by */
    ACT_GO(desk_flip_by);
    e_action_predef_name_set(_("Desktop"), _("Flip Desktop Left"), 
"desk_flip_by", "-1 0", NULL, 0);
Index: e17/apps/e/src/bin/e_border.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.571
diff -u -r1.571 e_border.c
--- e17/apps/e/src/bin/e_border.c       14 Feb 2007 02:43:34 -0000      1.571
+++ e17/apps/e/src/bin/e_border.c       27 Feb 2007 06:23:30 -0000
@@ -2239,6 +2239,35 @@
      e_remember_update(bd->remember, bd);
 }
 
+EAPI void
+e_border_pinned_set(E_Border *bd, int set) 
+{
+  int layer;
+  int stacking; 
+
+   if (bd) 
+     { 
+       bd->borderless = set; 
+       bd->user_skip_winlist = set; 
+       if (set) 
+         { 
+            layer = 50;
+            stacking = E_STACKING_BELOW;
+         } 
+       else 
+         { 
+            layer = 100;
+            stacking = E_STACKING_NONE;
+         } 
+       
+       e_border_layer_set(bd, layer); 
+       e_hints_window_stacking_set(bd, stacking); 
+
+       bd->client.border.changed = 1; 
+       bd->changed = 1; 
+     } 
+} 
+
 EAPI E_Border *
 e_border_find_by_client_window(Ecore_X_Window win)
 {
Index: e17/apps/e/src/bin/e_border.h
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_border.h,v
retrieving revision 1.154
diff -u -r1.154 e_border.h
--- e17/apps/e/src/bin/e_border.h       22 Feb 2007 05:17:44 -0000      1.154
+++ e17/apps/e/src/bin/e_border.h       27 Feb 2007 06:23:30 -0000
@@ -351,7 +351,6 @@
    unsigned int    need_maximize : 1;
    E_Maximize      maximized;
    unsigned int    borderless : 1;
-   unsigned int    pinned_to_desktop : 1;
    const char     *bordername;
 
    unsigned int    lock_user_location : 1; /*DONE*/
@@ -594,6 +593,7 @@
 EAPI void      e_border_uniconify(E_Border *bd);
 EAPI void      e_border_stick(E_Border *bd);
 EAPI void      e_border_unstick(E_Border *bd);
+EAPI void      e_border_pinned_set(E_Border *bd, int set);
 
 EAPI E_Border *e_border_find_by_client_window(Ecore_X_Window win);
 EAPI E_Border *e_border_find_by_frame_window(Ecore_X_Window win);
Index: e17/apps/e/src/bin/e_int_border_menu.c
===================================================================
RCS file: /var/cvs/e/e17/apps/e/src/bin/e_int_border_menu.c,v
retrieving revision 1.56
diff -u -r1.56 e_int_border_menu.c
--- e17/apps/e/src/bin/e_int_border_menu.c      22 Feb 2007 05:17:44 -0000      
1.56
+++ e17/apps/e/src/bin/e_int_border_menu.c      27 Feb 2007 06:23:32 -0000
@@ -184,7 +184,9 @@
                                  "e/widgets/border/default/sendto");
      }
 
-   if (!bd->pinned_to_desktop)
+   if ((bd->client.netwm.state.stacking != E_STACKING_BELOW) || 
+       (!bd->user_skip_winlist) ||
+       (!bd->borderless))
      {
        mi = e_menu_item_new(m);
        e_menu_item_label_set(mi, _("Pin to Desktop"));
@@ -195,7 +197,9 @@
                                  "e/widgets/border/default/stick");
      }
    
-   if (bd->pinned_to_desktop)
+   if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) && 
+       (bd->user_skip_winlist) &&
+       (bd->borderless))
      {
        mi = e_menu_item_new(m);
        e_menu_item_label_set(mi, _("Unpin from Desktop"));
@@ -827,19 +831,7 @@
    bd = e_object_data_get(E_OBJECT(m));
    if (bd)
      {
-       bd->pinned_to_desktop = 1;
-       bd->borderless = 1;
-       bd->user_skip_winlist = 1;
-       bd->client.netwm.state.stacking = E_STACKING_BELOW;
-
-        if (bd->layer != 50)
-          {
-            e_border_layer_set(bd, 50);
-            e_hints_window_stacking_set(bd, E_STACKING_BELOW);
-          }
-
-       bd->client.border.changed = 1;
-       bd->changed = 1;
+       e_border_pinned_set(bd, 1);
      }
 }
 
@@ -851,19 +843,7 @@
    bd = e_object_data_get(E_OBJECT(m));
    if (bd)
      {
-       bd->pinned_to_desktop = 0;
-       bd->borderless = 0;
-       bd->user_skip_winlist = 0;
-       bd->client.netwm.state.stacking = E_STACKING_NONE;
-
-        if (bd->layer != 100)
-          {
-            e_border_layer_set(bd, 100);
-            e_hints_window_stacking_set(bd, E_STACKING_NONE);
-          }
-
-       bd->client.border.changed = 1;
-       bd->changed = 1;
+       e_border_pinned_set(bd, 0);
      }
 }
 
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to