This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 four-corners/TODO      |    4 +-
 four-corners/fc.c      |   66 +++++++++++++++++++++++++++++++----------------
 four-corners/fc.xml.in |    8 +++---
 3 files changed, 49 insertions(+), 29 deletions(-)

New commits:
commit 5131bfc8f41a661eeb9532bcd55c08aa15ee20de
Author: Shane Bryan <[EMAIL PROTECTED]>
Date:   Thu Aug 7 16:54:13 2008 -0700

    - Added corner app triggering mechanism.
    
    Signed-off-by: Shane Bryan <[EMAIL PROTECTED]>


Diff in this email is a maximum of 400 lines.
diff --git a/four-corners/TODO b/four-corners/TODO
index 987b7a7..fbc2d2c 100644
--- a/four-corners/TODO
+++ b/four-corners/TODO
@@ -1,12 +1,12 @@
 
 Moblin Four Courners Compiz plugin TODO list:
-- add corner app triggering mechanism
-
 - Add option to each corner to enable or disable it
 
 - Add user configurable keybinding mapping to trigger button "press" events in
   addition to mouse based events
 
+- Experiment with using Genesis to launch apps by name
+
 - cool visualizations (lighting, motion, shadows) on buttons when interesting
   events happen on/near them
 
diff --git a/four-corners/fc.c b/four-corners/fc.c
index fb07600..fabdfde 100644
--- a/four-corners/fc.c
+++ b/four-corners/fc.c
@@ -45,7 +45,7 @@ int FCGravity[4] = { 0, 1, 2, 3, };
 typedef struct _FCButton {
     void (*draw)(CompScreen *s, struct _FCButton *b);
     void (*press)(int g);
-    void (*release)(int g);
+    void (*release)(CompScreen *s, int g);
 
     Bool         pressed;  // flag to tell us if the button press state
     enum Gravity gravity;  // which corner does this button live in
@@ -83,13 +83,14 @@ typedef struct _FCCorner {
     char     *name;
     char     *filename;
     FCButton *button;
+       CompWindow *window;
 } FCCorner;
 
 FCCorner corners[4] = {
-    { "Utah", "", NULL, },
-    { "Colorado", "", NULL, },
-    { "Arizona", "", NULL, },
-    { "NewMexico", "", NULL, },
+    { "Utah", "", NULL, NULL, },
+    { "Colorado", "", NULL, NULL, },
+    { "Arizona", "", NULL, NULL, },
+    { "NewMexico", "", NULL, NULL, },
 };
 
 typedef struct _FCDisplay {
@@ -139,16 +140,14 @@ typedef struct _FCScreen {
 
 static Bool fcUpdateWindowMatch (CompWindow *w)
 {
-    FC_DISPLAY(w->screen->display);
-
     if (matchEval (fcGetUtahMatch(w->screen), w))
-        fc_display->utah_window = w;
+        corners[NW].window = w;
     else if (matchEval (fcGetColoradoMatch(w->screen), w))
-        fc_display->colorado_window = w;
+        corners[NE].window = w;
     else if (matchEval (fcGetNewmexicoMatch(w->screen), w))
-        fc_display->newmexico_window = w;
+        corners[SE].window = w;
     else if (matchEval (fcGetArizonaMatch(w->screen), w))
-        fc_display->arizona_window = w;
+        corners[SW].window = w;
     else
         return FALSE;
 
@@ -191,7 +190,7 @@ static void fcButtonPressed(int g)
 }
 
 // One of the corner buttons was released
-static void fcButtonReleased(int g)
+static void fcButtonReleased(CompScreen *s, int g)
 {
     if (corners[g].button->pressed)
     {
@@ -202,6 +201,30 @@ static void fcButtonReleased(int g)
         // TODO: When we have visual "press" cueing, need to uncue here
         // =============================================================
         // corners[g].button->action();
+           if (corners[g].window)
+           {
+               // Raise the window
+                   raiseWindow(corners[g].window);
+           }
+           else
+           {
+               // Execute the command
+                       switch (g)
+                       {
+                       case NW:
+                               runCommand(s,fcGetUtahAction(s));
+                               break;
+                       case NE:
+                               runCommand(s,fcGetColoradoAction(s));
+                               break;
+                       case SW:
+                               runCommand(s,fcGetArizonaAction(s));
+                               break;
+                       case SE:
+                               runCommand(s,fcGetNewmexicoAction(s));
+                               break;
+                       }
+           }
     }
     else
     // This button was not originally pressed, but one of the other was
@@ -785,7 +808,7 @@ static void fcHandleEvent (CompDisplay *d, XEvent *event)
                 {
                     // If there is a release function for this button, call it
                     if (corners[g].button->release)
-                        corners[g].button->release(g);
+                        corners[g].button->release(s,g);
                 }
                 // Release occured in a corner button that was not "pressed"
                 else
@@ -1125,16 +1148,13 @@ static Bool fcInitWindow (CompPlugin *p, CompWindow *w)
 
 static void fcFiniWindow (CompPlugin *p, CompWindow *w)
 {
-    FC_DISPLAY(w->screen->display);
-
-    if (w == fc_display->utah_window)
-       fc_display->utah_window = NULL;
-    else if (w == fc_display->colorado_window)
-       fc_display->colorado_window = NULL;
-    else if (w == fc_display->newmexico_window)
-       fc_display->newmexico_window = NULL;
-    else if (w == fc_display->colorado_window)
-       fc_display->arizona_window = NULL;
+       int i;
+
+    for (i=0;i<4;i++)
+    {
+        if (w == corners[i].window)
+            corners[i].window = NULL;
+    }
 }
 
 static CompBool fcInitObject (CompPlugin *p, CompObject *o)
diff --git a/four-corners/fc.xml.in b/four-corners/fc.xml.in
index d2ff8f0..7652865 100644
--- a/four-corners/fc.xml.in
+++ b/four-corners/fc.xml.in
@@ -67,7 +67,7 @@
                     <option name="utah_match" type="match">
                         <_short>Rule</_short>
                         <_long>Specify the Window Match rule that identifies 
Application to raise</_long>
-                        <default>(class=Moblin-Core) &amp; role=Utah</default>
+                        <default>class=moblin-sharing</default>
                     </option>
                     <option name="utah_action" type="string">
                         <_short>Command</_short>
@@ -87,7 +87,7 @@
                     <option name="colorado_match" type="match">
                         <_short>Rule</_short>
                         <_long>Specify the Window Match rule that identifies 
Application to raise</_long>
-                        <default>(class=Moblin-Core) &amp; 
role=Colorado</default>
+                        <default>class=moblin-switcher</default>
                     </option>
                     <option name="colorado_action" type="string">
                         <_short>Command</_short>
@@ -107,7 +107,7 @@
                     <option name="arizona_match" type="match">
                         <_short>Rule</_short>
                         <_long>Specify the Window Match rule that identifies 
Application to raise</_long>
-                        <default>(class=Moblin-Core) &amp; 
role=Arizona</default>
+                        <default>class=moblin-menu</default>
                     </option>
                     <option name="arizona_action" type="string">
                         <_short>Command</_short>
@@ -127,7 +127,7 @@
                     <option name="newmexico_match" type="match">
                         <_short>Rule</_short>
                         <_long>Specify the Window Match rule that identifies 
Application to raise</_long>
-                        <default>(class=Moblin-Core) &amp; 
role=NewMexico</default>
+                        <default>class=moblin-status</default>
                     </option>
                     <option name="newmexico_action" type="string">
                         <_short>Command</_short>
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to