Project

General

Profile

1811q_20150913_1.txt

Sergey Ivanovskiy, 09/13/2015 07:09 PM

Download (6.82 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
2
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-09-07 17:08:14 +0000
3
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-09-13 22:30:59 +0000
4
@@ -668,7 +668,7 @@
5
                       offset = offset + 1;
6
                       
7
                       var theWindow = p2j.screen.getWindow(windowID);
8
-                      p2j.logger.log("recieved 0x99: iconified = " + iconified);
9
+                      //p2j.logger.log("recieved 0x99: iconified = " + iconified + " windowId=" + windowID);
10
                       if (iconified)
11
                       {
12
                          theWindow.iconify();
13

    
14
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
15
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-09-11 19:19:05 +0000
16
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-09-13 22:30:08 +0000
17
@@ -465,9 +465,19 @@
18
       // this code depends on each canvas being style.position = 'absolute' so that it is
19
       // outside of the browser's layout processing
20
       this.canvas.style.visibility = visible ? "visible" : "hidden";
21
-      
22
-      // bring to the top of the z-order
23
-      moveZOrderEntryToTop(this.id);
24
+      if (visible)
25
+      {
26
+         // bring to the top of the z-order
27
+         moveZOrderEntryToTop(this.id);
28
+      }
29
+   };
30
+   
31
+   /**
32
+    * Is visible.
33
+    */
34
+   Window.prototype.isVisible = function()
35
+   {
36
+      return this.canvas.style.visibility === "visible";
37
    };
38
    
39
    /**
40
@@ -936,11 +946,11 @@
41
     */
42
    Window.prototype.iconify = function()
43
    {
44
-      p2j.logger.log("Window.prototype.iconify(" + this.id + ")");
45
+      //p2j.logger.log("Window.prototype.iconify(" + this.id + ")");
46
 
47
       this.setVisible(false);
48
-
49
       taskBar.iconify(this.id);
50
+      activateTopVisibleWindow(this.id);
51
    };
52
    
53
    /**
54
@@ -948,7 +958,7 @@
55
     */
56
    Window.prototype.deiconify = function()
57
    {
58
-      p2j.logger.log("Window.prototype.deiconify(" + this.id + ")");
59
+      //p2j.logger.log("Window.prototype.deiconify(" + this.id + ")");
60
 
61
       this.setVisible(true);
62
 
63
@@ -1005,6 +1015,45 @@
64
    };
65
 
66
    /**
67
+    * Move the first upper visible window to the top of other visible windows
68
+    * after the selected window is minimized.
69
+    * 
70
+    * @param    {Number} id
71
+    *           The id of the window that has been minimized.
72
+    */
73
+   function activateTopVisibleWindow(id)
74
+   {
75
+      var topWindow = findTopVisibleWindow(id);
76
+      if (topWindow)
77
+      {
78
+         topWindow.moveToTop();
79
+      }
80
+   }
81
+
82
+   /**
83
+    * Find a visible window having the maximal z-index from all windows that are different
84
+    * from the selected window.
85
+    * 
86
+    * @param    {Number} id
87
+    *           The id of the selected window.
88
+    * 
89
+    * @return   {Window}
90
+    *           The first different visible window having the maximal z-index.
91
+    */
92
+   function findTopVisibleWindow(id)
93
+   {
94
+      for(var j = zlist.length - 1; j >=0; j--)
95
+      {
96
+         var win = zlist[j].win;
97
+         if ((win.id !== id) && win.isVisible())
98
+         {
99
+            return win;
100
+         }
101
+      }
102
+      return null;
103
+   }
104
+
105
+   /**
106
     * Find the index of the given window in the z-order list.
107
     *
108
     * @param    {Number} wid
109
@@ -1440,6 +1489,7 @@
110
     */
111
    me.setWindowVisible = function(wid, visible)
112
    {
113
+      //p2j.logger.log("setWindowVisible: wid = " + wid + " visible = " + visible);
114
       if (!isValidWindowId(wid))
115
       {
116
          me.error("Cannot change visibility for window for id that is invalid.");
117
@@ -1478,6 +1528,7 @@
118
     */
119
    me.restackZOrderEntries = function(wids)
120
    {
121
+      //p2j.logger.log("restackZOrderEntries: top window = " + wids[wids.length - 1]);
122
       if (zlist.length != wids.length)
123
       {
124
          me.error("Restacking list must have the same number of elements as the z-order list!");
125
@@ -1508,6 +1559,7 @@
126
          
127
          addZOrderEntry(wids[i], win);
128
       }
129
+      taskBar.setTaskIconActive(wids[wids.length - 1], true);
130
    };
131
    
132
    /**
133

    
134
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.virtual_desktop.js'
135
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.virtual_desktop.js	2015-09-11 19:19:05 +0000
136
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.virtual_desktop.js	2015-09-13 22:28:43 +0000
137
@@ -567,7 +567,7 @@
138
       this.addTaskIcon    = addTaskIcon;
139
 
140
       /**
141
-       * Adds new task to the task bar.
142
+       * Adds new task to the task bar. Check if there exists. New created task is hidden. 
143
        * 
144
        * @param    {Number} windowId
145
        *           The id of the window that needs to be represented by this task.
146
@@ -577,12 +577,16 @@
147
        */
148
       function addTaskIcon(windowId)
149
       {
150
-         var taskIcon = findTaskIcon(windowId);
151
+         var taskIcon = findWidget(windowId, taskIcons);
152
          if (taskIcon === null)
153
          {
154
-            taskIcon = new TaskIcon(windowId, TASK_ICON_WIDTH, TASK_ICON_HEIGHT, foreground,
155
-                  "", null, 0, 0);
156
-            taskIcons.push(taskIcon);
157
+            taskIcon = findWidget(windowId, hiddenTaskIcons);
158
+            if (taskIcon === null)
159
+            {
160
+               taskIcon = new TaskIcon(windowId, TASK_ICON_WIDTH, TASK_ICON_HEIGHT, foreground,
161
+                     "", null, 0, 0);
162
+               hiddenTaskIcons.push(taskIcon);
163
+            }
164
          }
165
          return taskIcon;
166
       };
167
@@ -655,22 +659,13 @@
168
             //shrunk the task icons by removing it
169
             widgetsToRemove.splice(index, 1);
170
             widgetsToAdd.push(taskIcon);
171
+            if (visible)
172
+            {
173
+               // sets the current position in visible task icon list
174
+               taskIcon.index = widgetsToAdd.length - 1;
175
+            }
176
             //if the task icon becomes visible it should be active
177
             updateTaskBar(taskIcon, visible)
178
-            return taskIcon;
179
-         }
180
-         // task icon is already visible
181
-         taskIcon = findWidget(windowId, taskIcons);
182
-         if (taskIcon)
183
-         {
184
-            updateTaskBar(taskIcon, visible);
185
-            return taskIcon;
186
-         }
187
-         // task icon is already hidden
188
-         taskIcon = findWidget(windowId, hiddenTaskIcons);
189
-         if (taskIcon)
190
-         {
191
-            updateTaskBar(taskIcon, visible);
192
          }
193
          
194
          return taskIcon;
195
@@ -1011,12 +1006,10 @@
196
             var taskIcon = taskIcons[i];
197
             if (taskIcon.testMousePointerInside(event) && !taskIcon.isActive())
198
             {
199
-               updateTaskBar(taskIcon, true);
200
                if (taskIconOnClickCallback)
201
                {
202
                   taskIconOnClickCallback(taskIcon.id);
203
                }
204
-               taskIcon.draw();
205
                break;
206
             }
207
             
208