ZealOS/docs/System/Win.CC.html
TomAwezome 1b75d91002 Fix Mount AHCI Port selection.
Add arg to SATARep to specify drive types to show.
Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
2021-08-02 16:40:05 -04:00

645 lines
72 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.13">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Windows&quot;</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>&quot;::/Doc/Windows&quot;</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF9>CMouseStateGlobals</span><span class=cF0> </span><span class=cFB>old_mouse</span><span class=cF0> = {</span><span class=cF7>{</span><span class=cF0>-</span><span class=cFE>1000</span><span class=cF0>, -</span><span class=cFE>1000</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>}</span><span class=cF0>, </span><span class=cF7>{</span><span class=cF0>-</span><span class=cFE>1000</span><span class=cF0>, -</span><span class=cFE>1000</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>}</span><span class=cF0>, </span><span class=cF7>{</span><span class=cF0>-</span><span class=cFE>1000</span><span class=cF0>, -</span><span class=cFE>1000</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>}</span><span class=cF0>,
<a name="l5"></a> </span><span class=cF7>{</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF7>}</span><span class=cF0>, </span><span class=cF7>{</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>}</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF5>TSCGet</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>350</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
<a name="l6"></a> </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>
<a name="l7"></a>};
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CWinMgrGlobals</span><span class=cF0> </span><span class=cFB>winmgr</span><span class=cF0> = {</span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>WINMGR_FPS</span><span class=cF0>, </span><span class=cF5>tS</span><span class=cF0>, </span><span class=cF5>tS</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>};
<a name="l10"></a></span><span class=cFB>winmgr</span><span class=cF0>.t = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CWinMgrTimingGlobals</span><span class=cF7>)</span><span class=cF0>);
<a name="l11"></a></span><span class=cFB>winmgr</span><span class=cF0>.t-&gt;last_calc_idle_time = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l12"></a>
<a name="l13"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ProgressBarsRegTf</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l14"></a>{
<a name="l15"></a> </span><span class=cF1>F64</span><span class=cF0> t, p1, p2, p3, p4;
<a name="l16"></a>
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (path)
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> t = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>progress1_t0</span><span class=cF0>) p1 = t - </span><span class=cFB>progress1_t0</span><span class=cF0>; </span><span class=cF1>else</span><span class=cF0> p1 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>progress2_t0</span><span class=cF0>) p2 = t - </span><span class=cFB>progress2_t0</span><span class=cF0>; </span><span class=cF1>else</span><span class=cF0> p2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>progress3_t0</span><span class=cF0>) p3 = t - </span><span class=cFB>progress3_t0</span><span class=cF0>; </span><span class=cF1>else</span><span class=cF0> p3 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>progress4_t0</span><span class=cF0>) p4 = t - </span><span class=cFB>progress4_t0</span><span class=cF0>; </span><span class=cF1>else</span><span class=cF0> p4 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l24"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(path, </span><span class=cF6>&quot;progress1_tf=%0.3f;progress2_tf=%0.3f;\n&quot;</span><span class=cF0>
<a name="l25"></a> </span><span class=cF6>&quot;progress3_tf=%0.3f;progress4_tf=%0.3f;\n&quot;</span><span class=cF0>, p1, p2, p3, p4);
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a>}
<a name="l28"></a>
<a name="l29"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF0> </span><span class=cFE>20</span><span class=cF0>
<a name="l30"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF0> (</span><span class=cFE>3</span><span class=cF0> * </span><span class=cF3>GR_WIDTH</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>)
<a name="l31"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawProgressBars</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l32"></a>{
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, k, n, m;
<a name="l34"></a> </span><span class=cF1>U8</span><span class=cF0> *st, *st2;
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0>; i++)
<a name="l37"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (m = </span><span class=cFB>sys_progresses</span><span class=cF0>[i].max)
<a name="l39"></a> {
<a name="l40"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l41"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
<a name="l42"></a> </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> -(</span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - i * </span><span class=cFE>4</span><span class=cF0>) * </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>,
<a name="l43"></a> </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF0>, </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF0>);
<a name="l44"></a>
<a name="l45"></a> dc-&gt;color = </span><span class=cF3>LTGREEN</span><span class=cF0>;
<a name="l46"></a> n = </span><span class=cFB>sys_progresses</span><span class=cF0>[i].val;
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (n&gt;m)
<a name="l48"></a> n = m;
<a name="l49"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>,
<a name="l50"></a> </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> - (</span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - i * </span><span class=cFE>4</span><span class=cF0>) * </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>2</span><span class=cF0>,
<a name="l51"></a> n * </span><span class=cF7>(</span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0> / m,
<a name="l52"></a> </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0>);
<a name="l53"></a>
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (m&gt;</span><span class=cFE>1</span><span class=cF0>)
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l56"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l57"></a> k = m - </span><span class=cFE>1</span><span class=cF0>;
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (k &gt; </span><span class=cFE>19</span><span class=cF0>) k = </span><span class=cFE>19</span><span class=cF0>;
<a name="l59"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt;= k; j++)
<a name="l60"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> + j * </span><span class=cF7>(</span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0> / </span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>k + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>,
<a name="l61"></a> </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> - (</span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - i * </span><span class=cFE>4</span><span class=cF0>) * </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>4</span><span class=cF0>,
<a name="l62"></a> </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> + j * </span><span class=cF7>(</span><span class=cF3>PROGRESS_BAR_WIDTH</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0> / </span><span class=cF5>ToF64</span><span class=cF7>(</span><span class=cF0>k + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>,
<a name="l63"></a> </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> - (</span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>3</span><span class=cF0> - i * </span><span class=cFE>4</span><span class=cF0>) * </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>4</span><span class=cF0>);
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l65"></a>
<a name="l66"></a> dc-&gt;color = </span><span class=cF3>GREEN</span><span class=cF0>;
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (*</span><span class=cFB>sys_progresses</span><span class=cF0>[i].desc)
<a name="l68"></a> st = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cFB>sys_progresses</span><span class=cF0>[i].desc);
<a name="l69"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l70"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%d/%d&quot;</span><span class=cF0>, n, m);
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_progresses</span><span class=cF0>[i].t0)
<a name="l72"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l73"></a> st2 = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s %fs&quot;</span><span class=cF0>, st, </span><span class=cF5>tS</span><span class=cF0> - </span><span class=cFB>sys_progresses</span><span class=cF0>[i].t0);
<a name="l74"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l75"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l77"></a> st2 = st;
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_progresses</span><span class=cF0>[i].tf)
<a name="l79"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l80"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/%fs&quot;</span><span class=cF0>, st2, </span><span class=cFB>sys_progresses</span><span class=cF0>[i].tf);
<a name="l81"></a> </span><span class=cF5>Free</span><span class=cF0>(st2);
<a name="l82"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l84"></a> st = st2;
<a name="l85"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cF5>StrLen</span><span class=cF0>(st)</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF3>GR_HEIGHT</span><span class=cF0> - </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> -
<a name="l86"></a> (</span><span class=cF3>PROGRESS_BARS_NUM</span><span class=cF0> * </span><span class=cFE>2</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> - i * </span><span class=cFE>4</span><span class=cF0>) * </span><span class=cF3>PROGRESS_BAR_HEIGHT</span><span class=cF7>)</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, st);
<a name="l87"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l88"></a> }
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a>}
<a name="l91"></a>
<a name="l92"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawWinGrid</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l93"></a>{
<a name="l94"></a> </span><span class=cF1>F64</span><span class=cF0> d;
<a name="l95"></a>
<a name="l96"></a> dc-&gt;color = </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l97"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF1>for</span><span class=cF0> (d = </span><span class=cFB>mouse_grid</span><span class=cF0>.x_offset; d &lt; </span><span class=cF3>GR_WIDTH</span><span class=cF0>; d += </span><span class=cFB>mouse_grid</span><span class=cF0>.x)
<a name="l99"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, d, </span><span class=cFE>0</span><span class=cF0>, d, </span><span class=cF3>GR_HEIGHT</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
<a name="l100"></a> </span><span class=cF1>for</span><span class=cF0> (d = </span><span class=cFB>mouse_grid</span><span class=cF0>.y_offset; d &lt; </span><span class=cF3>GR_HEIGHT</span><span class=cF0>; d += </span><span class=cFB>mouse_grid</span><span class=cF0>.y)
<a name="l101"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, d, </span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>, d);
<a name="l102"></a>}
<a name="l103"></a>
<a name="l104"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinGrid</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> val)
<a name="l105"></a>{
<a name="l106"></a> </span><span class=cF9>CGridGlobals</span><span class=cF0> last_grid;
<a name="l107"></a>
<a name="l108"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;last_grid, &amp;</span><span class=cFB>mouse_grid</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CGridGlobals</span><span class=cF7>)</span><span class=cF0>);
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (!val || </span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>mouse_grid</span><span class=cF7>)</span><span class=cF0>)
<a name="l110"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (!val)
<a name="l112"></a> </span><span class=cF5>GridInit</span><span class=cF0>;
<a name="l113"></a> </span><span class=cFB>mouse_hard</span><span class=cF0>.prescale.x *= last_grid.x_speed / </span><span class=cFB>mouse_grid</span><span class=cF0>.x_speed;
<a name="l114"></a> </span><span class=cFB>mouse_hard</span><span class=cF0>.prescale.y *= last_grid.y_speed / </span><span class=cFB>mouse_grid</span><span class=cF0>.y_speed;
<a name="l115"></a> </span><span class=cFB>mouse_hard</span><span class=cF0>.prescale.z *= last_grid.z_speed / </span><span class=cFB>mouse_grid</span><span class=cF0>.z_speed;
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l117"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l118"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;</span><span class=cFB>mouse_grid</span><span class=cF0>, &amp;last_grid, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CGridGlobals</span><span class=cF7>)</span><span class=cF0>);
<a name="l119"></a>}
<a name="l120"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CtrlAltG</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc)
<a name="l121"></a>{
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l123"></a> </span><span class=cF5>PopUp</span><span class=cF0>(</span><span class=cF6>&quot;WinGrid(OFF);&quot;</span><span class=cF0>);
<a name="l124"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l125"></a> </span><span class=cF5>PopUp</span><span class=cF0>(</span><span class=cF6>&quot;WinGrid(ON);&quot;</span><span class=cF0>);
<a name="l126"></a>}
<a name="l127"></a></span><span class=cF5>CtrlAltCBSet</span><span class=cF0>(</span><span class=cF6>'G'</span><span class=cF0>, &amp;</span><span class=cF5>CtrlAltG</span><span class=cF0>, </span><span class=cF6>&quot;Cmd /Grid On&quot;</span><span class=cF0>, </span><span class=cF6>&quot;Cmd /Grid Off&quot;</span><span class=cF0>);
<a name="l128"></a>
<a name="l129"></a></span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cFB>ext_ASCII_task</span><span class=cF0>;
<a name="l130"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>ExtendedASCII</span><span class=cF0>()
<a name="l131"></a>{
<a name="l132"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l133"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l134"></a>
<a name="l135"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;Sel Char and Press &lt;ESC&gt;\n$LTBLUE$&quot;</span><span class=cF0>);
<a name="l136"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i&lt;</span><span class=cFE>256</span><span class=cF0>; i++)
<a name="l137"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cF3>CH_SPACE</span><span class=cF0> &amp;&amp; i != </span><span class=cFE>0x7F</span><span class=cF0>)
<a name="l139"></a> {
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (i == </span><span class=cF6>'$'</span><span class=cF0>)
<a name="l141"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$MU-UL,\&quot;\\x24\&quot;,LE=%d$&quot;</span><span class=cF0>, i);
<a name="l142"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i==</span><span class=cF6>'\&quot;'</span><span class=cF0> || i == </span><span class=cF6>'\\'</span><span class=cF0>)
<a name="l143"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$MU-UL,\&quot;\\%c\&quot;,LE=%d$&quot;</span><span class=cF0>, i, i);
<a name="l144"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l145"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$MU-UL,\&quot;%c\&quot;,LE=%d$&quot;</span><span class=cF0>, i, i);
<a name="l146"></a> }
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l148"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot; &quot;</span><span class=cF0>);
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cFE>15</span><span class=cF0> == </span><span class=cFE>15</span><span class=cF0>)
<a name="l150"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\n&quot;</span><span class=cF0>);
<a name="l151"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l152"></a> i = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l153"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l155"></a> </span><span class=cF5>MessagePost</span><span class=cF0>(</span><span class=cFB>ext_ASCII_task</span><span class=cF0>, </span><span class=cF3>MESSAGE_KEY_DOWN_UP</span><span class=cF0>, i, </span><span class=cF5>Char2ScanCode</span><span class=cF7>(</span><span class=cF0>i</span><span class=cF7>)</span><span class=cF0>);
<a name="l156"></a>}
<a name="l157"></a>
<a name="l158"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CtrlAltA</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0>)
<a name="l159"></a>{
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>ext_ASCII_task</span><span class=cF0> = </span><span class=cFB>sys_focus_task</span><span class=cF0>)
<a name="l161"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;</span><span class=cF5>ExtendedASCII</span><span class=cF0>);
<a name="l162"></a>}
<a name="l163"></a></span><span class=cF5>CtrlAltCBSet</span><span class=cF0>(</span><span class=cF6>'A'</span><span class=cF0>, &amp;</span><span class=cF5>CtrlAltA</span><span class=cF0>, </span><span class=cF6>&quot;Cmd /Extended ASCII&quot;</span><span class=cF0>);
<a name="l164"></a>
<a name="l165"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinScrollNull</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CD3I64</span><span class=cF0> *s)
<a name="l166"></a>{</span><span class=cF2>//If panning a window has been done, restore to zero.</span><span class=cF0>
<a name="l167"></a> s-&gt;x = task-&gt;scroll_x;
<a name="l168"></a> s-&gt;y = task-&gt;scroll_y;
<a name="l169"></a> s-&gt;z = task-&gt;scroll_z;
<a name="l170"></a> task-&gt;scroll_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l171"></a> task-&gt;scroll_y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l172"></a> task-&gt;scroll_z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l173"></a>}
<a name="l174"></a>
<a name="l175"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinScrollRestore</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task, </span><span class=cF9>CD3I64</span><span class=cF0> *s)
<a name="l176"></a>{</span><span class=cF2>//Set window pan value to stored value.</span><span class=cF0>
<a name="l177"></a> task-&gt;scroll_x = s-&gt;x;
<a name="l178"></a> task-&gt;scroll_y = s-&gt;y;
<a name="l179"></a> task-&gt;scroll_z = s-&gt;z;
<a name="l180"></a>}
<a name="l181"></a>
<a name="l182"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawMouse</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l183"></a>{
<a name="l184"></a> </span><span class=cF9>I64</span><span class=cF0> x, y;
<a name="l185"></a>
<a name="l186"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l187"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l188"></a> x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x;
<a name="l189"></a> y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y;
<a name="l190"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse</span><span class=cF0>.show &amp;&amp; </span><span class=cFB>mouse_hard</span><span class=cF0>.installed)
<a name="l192"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr</span><span class=cF0>.fp_draw_mouse)
<a name="l194"></a> {
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>winmgr</span><span class=cF0>.grab_scroll &amp;&amp; </span><span class=cFB>gr</span><span class=cF0>.fp_draw_grab_mouse)
<a name="l196"></a> (*</span><span class=cFB>gr</span><span class=cF0>.fp_draw_grab_mouse)(dc, x, y, </span><span class=cFB>winmgr</span><span class=cF0>.grab_scroll_closed);
<a name="l197"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l198"></a> (*</span><span class=cFB>gr</span><span class=cF0>.fp_draw_mouse)(dc, x, y);
<a name="l199"></a> }
<a name="l200"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l201"></a>}
<a name="l202"></a>
<a name="l203"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinFinalUpdate</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l204"></a>{
<a name="l205"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_grid</span><span class=cF0>.show)
<a name="l206"></a> </span><span class=cF5>DrawWinGrid</span><span class=cF0>(dc);
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_grid</span><span class=cF0>.coord)
<a name="l208"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cFE>10</span><span class=cF0>, </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> * </span><span class=cFE>3</span><span class=cF0>, </span><span class=cF6>&quot;(%03d,%03d)&quot;</span><span class=cF0>, </span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y);
<a name="l209"></a> </span><span class=cF5>DrawProgressBars</span><span class=cF0>(dc);
<a name="l210"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>winmgr</span><span class=cF0>.show_menu)
<a name="l211"></a> </span><span class=cF5>DrawMenu</span><span class=cF0>(dc);
<a name="l212"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l213"></a> </span><span class=cFB>sys_cur_submenu_entry</span><span class=cF0> = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l214"></a> </span><span class=cF5>DrawMouse</span><span class=cF0>(dc);
<a name="l215"></a>}
<a name="l216"></a>
<a name="l217"></a></span><span class=cFB>gr</span><span class=cF0>.fp_final_screen_update = &amp;</span><span class=cF5>WinFinalUpdate</span><span class=cF0>;
<a name="l218"></a>
<a name="l219"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinMouseUpdate</span><span class=cF0>()
<a name="l220"></a>{
<a name="l221"></a> </span><span class=cF9>I64</span><span class=cF0> dd;
<a name="l222"></a> </span><span class=cF1>Bool</span><span class=cF0> set = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l223"></a>
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_hard</span><span class=cF0>.installed)
<a name="l225"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l226"></a> </span><span class=cFB>mouse</span><span class=cF0>.has_wheel = </span><span class=cFB>mouse_hard</span><span class=cF0>.has_wheel;
<a name="l227"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_hard</span><span class=cF0>.event)
<a name="l228"></a> {
<a name="l229"></a> </span><span class=cF5>MouseUpdate</span><span class=cF0>(</span><span class=cFB>mouse_hard</span><span class=cF0>.pos.x, </span><span class=cFB>mouse_hard</span><span class=cF0>.pos.y, </span><span class=cFB>mouse_hard</span><span class=cF0>.pos.z, </span><span class=cFB>mouse_hard</span><span class=cF0>.bttns[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cFB>mouse_hard</span><span class=cF0>.bttns[</span><span class=cFE>1</span><span class=cF0>]);
<a name="l230"></a> </span><span class=cFB>mouse_hard</span><span class=cF0>.event = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l231"></a> set = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l232"></a> }
<a name="l233"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l234"></a>
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (set)
<a name="l236"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_hard</span><span class=cF0>.installed)
<a name="l238"></a> {
<a name="l239"></a> </span><span class=cFB>mouse</span><span class=cF0>.speed = </span><span class=cFB>mouse_hard</span><span class=cF0>.speed;
<a name="l240"></a> </span><span class=cFB>mouse</span><span class=cF0>.timestamp = </span><span class=cFB>mouse_hard</span><span class=cF0>.timestamp;
<a name="l241"></a> }
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l243"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l244"></a> </span><span class=cFB>mouse</span><span class=cF0>.speed *= </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>95</span><span class=cF0>;
<a name="l245"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr</span><span class=cF0>.screen_zoom != </span><span class=cFE>1</span><span class=cF0>)
<a name="l246"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>gr</span><span class=cF0>.continuous_scroll)
<a name="l248"></a> </span><span class=cF5>GrScaleZoom</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l249"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l250"></a> {
<a name="l251"></a> dd = (</span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cFB>gr</span><span class=cF0>.sx) * </span><span class=cFB>gr</span><span class=cF0>.screen_zoom;
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>8</span><span class=cF0> &lt;= dd &lt; </span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cFE>8</span><span class=cF7>)</span><span class=cF0>)
<a name="l253"></a> </span><span class=cF5>GrScaleZoom</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l254"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l255"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l256"></a> dd = (</span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cFB>gr</span><span class=cF0>.sy) * </span><span class=cFB>gr</span><span class=cF0>.screen_zoom;
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>8</span><span class=cF0> &lt;= dd &lt; </span><span class=cF3>GR_HEIGHT</span><span class=cF0> - </span><span class=cFE>8</span><span class=cF7>)</span><span class=cF0>)
<a name="l258"></a> </span><span class=cF5>GrScaleZoom</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>);
<a name="l259"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l260"></a> }
<a name="l261"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l262"></a>}
<a name="l263"></a>
<a name="l264"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>WinRefocus</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l265"></a>{</span><span class=cF2>//Reset the focus task if NULL.</span><span class=cF0>
<a name="l266"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l267"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l268"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l269"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l270"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>-&gt;last_task;
<a name="l271"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>)
<a name="l272"></a> {
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l274"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l275"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0> = task;
<a name="l276"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l277"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l278"></a> task = task-&gt;last_task;
<a name="l279"></a> }
<a name="l280"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l281"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l282"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>sys_focus_task</span><span class=cF0>;
<a name="l283"></a>}
<a name="l284"></a>
<a name="l285"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>WinOnTopWindows</span><span class=cF0>()
<a name="l286"></a>{
<a name="l287"></a> </span><span class=cF9>CTask</span><span class=cF0> *task, *task1, *first_moved_fwd = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l288"></a> </span><span class=cF9>I64</span><span class=cF0> res=</span><span class=cFE>0</span><span class=cF0>;
<a name="l289"></a>
<a name="l290"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l291"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l292"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>-&gt;next_task;
<a name="l293"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0> &amp;&amp; task != first_moved_fwd)
<a name="l294"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l295"></a> task1 = task-&gt;next_task;
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l297"></a> {
<a name="l298"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l299"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l300"></a> }
<a name="l301"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_WIN_ON_TOP</span><span class=cF7>)</span><span class=cF0> &amp;&amp; task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>-&gt;last_task)
<a name="l302"></a> {
<a name="l303"></a> </span><span class=cF5>TaskQueueRemove</span><span class=cF0>(task);
<a name="l304"></a> </span><span class=cF5>TaskQueueIns</span><span class=cF0>(task, </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l305"></a> res++;
<a name="l306"></a> </span><span class=cF1>if</span><span class=cF0> (!first_moved_fwd)
<a name="l307"></a> first_moved_fwd = task;
<a name="l308"></a> }
<a name="l309"></a> task = task1;
<a name="l310"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l311"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l312"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l313"></a>}
<a name="l314"></a>
<a name="l315"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>WinToTop</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> update_z_buf = </span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l316"></a>{</span><span class=cF2>//Put task's win on top of window stack.</span><span class=cF0>
<a name="l317"></a> </span><span class=cF9>CTask</span><span class=cF0> *task1;
<a name="l318"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l319"></a>
<a name="l320"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l321"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> || task-&gt;gs-&gt;num)
<a name="l323"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l324"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l325"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>sys_winmgr_task</span><span class=cF0> || task==</span><span class=cFB>sys_winmgr_task</span><span class=cF0>)
<a name="l326"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l327"></a>
<a name="l328"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l329"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l331"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l332"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l333"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l334"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>-&gt;last_task)
<a name="l336"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l337"></a> </span><span class=cF5>TaskQueueRemove</span><span class=cF0>(task);
<a name="l338"></a> </span><span class=cF5>TaskQueueIns</span><span class=cF0>(task, </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l339"></a> res++;
<a name="l340"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l342"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0> = task;
<a name="l343"></a> </span><span class=cF1>if</span><span class=cF0> (res &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_CHILDREN_NOT_ON_TOP</span><span class=cF7>)</span><span class=cF0>)
<a name="l344"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l345"></a> task1 = task-&gt;next_child_task;
<a name="l346"></a> </span><span class=cF1>while</span><span class=cF0> (task1 != &amp;task-&gt;next_child_task)
<a name="l347"></a> {
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task1</span><span class=cF7>)</span><span class=cF0>)
<a name="l349"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l350"></a> res += </span><span class=cF5>WinToTop</span><span class=cF0>(task1, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l351"></a> task1 = task1-&gt;next_sibling_task;
<a name="l352"></a> }
<a name="l353"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;popup_task &amp;&amp; task-&gt;popup_task-&gt;parent_task == task)
<a name="l354"></a> res += </span><span class=cF5>WinToTop</span><span class=cF0>(task-&gt;popup_task, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l355"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l356"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l357"></a>
<a name="l358"></a> res += </span><span class=cF5>WinOnTopWindows</span><span class=cF0>;
<a name="l359"></a> </span><span class=cF1>if</span><span class=cF0> (res &amp;&amp; update_z_buf)
<a name="l360"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
<a name="l361"></a>
<a name="l362"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l363"></a>}
<a name="l364"></a></span><span class=cFB>ext</span><span class=cF0>[</span><span class=cF3>EXT_WIN_TO_TOP</span><span class=cF0>] = &amp;</span><span class=cF5>WinToTop</span><span class=cF0>;
<a name="l365"></a>
<a name="l366"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>WinFocus</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l367"></a>{</span><span class=cF2>//Set task as focus task.</span><span class=cF0>
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l369"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l370"></a>
<a name="l371"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l372"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l374"></a> task = </span><span class=cF5>WinRefocus</span><span class=cF0>(</span><span class=cFB>sys_focus_task</span><span class=cF0>);
<a name="l375"></a> </span><span class=cF5>WinToTop</span><span class=cF0>(</span><span class=cFB>sys_focus_task</span><span class=cF0> = task);
<a name="l376"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l377"></a>
<a name="l378"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>sys_focus_task</span><span class=cF0>;
<a name="l379"></a>}
<a name="l380"></a></span><span class=cFB>ext</span><span class=cF0>[</span><span class=cF3>EXT_WIN_FOCUS</span><span class=cF0>] = &amp;</span><span class=cF5>WinFocus</span><span class=cF0>;
<a name="l381"></a>
<a name="l382"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>WinHorz</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> left, </span><span class=cF9>I64</span><span class=cF0> right, </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l383"></a>{</span><span class=cF2>//Set task's win left and right columns.</span><span class=cF0>
<a name="l384"></a> </span><span class=cF9>I64</span><span class=cF0> d = right - left;
<a name="l385"></a>
<a name="l386"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l387"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l388"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l389"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l390"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt; </span><span class=cFE>0</span><span class=cF0>) d = </span><span class=cFE>0</span><span class=cF0>;
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (left &gt;= </span><span class=cF3>TEXT_COLS</span><span class=cF0>)
<a name="l392"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l393"></a> left = </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l394"></a> right = left + d;
<a name="l395"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (right &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l397"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l398"></a> right = </span><span class=cFE>0</span><span class=cF0>;
<a name="l399"></a> left = right - d;
<a name="l400"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (left &gt; right)
<a name="l402"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l403"></a> </span><span class=cF1>if</span><span class=cF0> (left &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l404"></a> right = left;
<a name="l405"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l406"></a> left = right;
<a name="l407"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l408"></a>
<a name="l409"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l410"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l411"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_left != left || task-&gt;win_right != right)
<a name="l412"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l413"></a> task-&gt;win_left = left;
<a name="l414"></a> task-&gt;win_right = right;
<a name="l415"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
<a name="l416"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l417"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l418"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l419"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l420"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l421"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l422"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l423"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l424"></a>}
<a name="l425"></a>
<a name="l426"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> top, </span><span class=cF9>I64</span><span class=cF0> bottom, </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l427"></a>{</span><span class=cF2>//Set task's win top and bottom rows.</span><span class=cF0>
<a name="l428"></a> </span><span class=cF9>I64</span><span class=cF0> d = bottom-top;
<a name="l429"></a>
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l431"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l432"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l433"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l434"></a> </span><span class=cF1>if</span><span class=cF0> (d &lt; </span><span class=cFE>0</span><span class=cF0>) d = </span><span class=cFE>0</span><span class=cF0>;
<a name="l435"></a> </span><span class=cF1>if</span><span class=cF0> (top &gt;= </span><span class=cF3>TEXT_ROWS</span><span class=cF0>)
<a name="l436"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l437"></a> top = </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l438"></a> bottom = top + d;
<a name="l439"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l440"></a> </span><span class=cF1>if</span><span class=cF0> (bottom &lt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l441"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l442"></a> bottom = </span><span class=cFE>1</span><span class=cF0>;
<a name="l443"></a> top = bottom - d;
<a name="l444"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (top &gt; bottom)
<a name="l446"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (top &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l448"></a> bottom = top;
<a name="l449"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l450"></a> top = bottom;
<a name="l451"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l452"></a>
<a name="l453"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l454"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l455"></a> </span><span class=cF1>if</span><span class=cF0> (task-&gt;win_top != top || task-&gt;win_bottom != bottom) </span><span class=cF7>{</span><span class=cF0>
<a name="l456"></a> task-&gt;win_top = top;
<a name="l457"></a> task-&gt;win_bottom = bottom;
<a name="l458"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task);
<a name="l459"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l460"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l461"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l462"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l463"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l464"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l465"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l466"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l467"></a>}
<a name="l468"></a>
<a name="l469"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinTileHorz</span><span class=cF0>()
<a name="l470"></a>{</span><span class=cF2>//Tile windows horizontally top-to-bottom.</span><span class=cF0>
<a name="l471"></a> </span><span class=cF9>CTask</span><span class=cF0> *task, *last_task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l472"></a> </span><span class=cF9>I64</span><span class=cF0> count, c, i, vert_size, no_border;
<a name="l473"></a>
<a name="l474"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l475"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l476"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
<a name="l477"></a> count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l478"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l479"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l480"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l481"></a> count++;
<a name="l482"></a> task = task-&gt;last_task;
<a name="l483"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l484"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l485"></a>
<a name="l486"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
<a name="l487"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l488"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l489"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l490"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l491"></a> {
<a name="l492"></a> no_border = </span><span class=cF5>Bt</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l493"></a> c = count - i &amp; ~</span><span class=cFE>3</span><span class=cF0>;
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (!c)
<a name="l495"></a> c = </span><span class=cFE>1</span><span class=cF0>;
<a name="l496"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (c &gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l497"></a> c = </span><span class=cFE>4</span><span class=cF0>;
<a name="l498"></a> vert_size = (</span><span class=cF3>TEXT_ROWS</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>) / c;
<a name="l499"></a>
<a name="l500"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0> - no_border, </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> + no_border, task);
<a name="l501"></a> </span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>i &amp; </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0> * vert_size + </span><span class=cFE>2</span><span class=cF0> - no_border, </span><span class=cF7>(</span><span class=cF0>i &amp; </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * vert_size + no_border, task);
<a name="l502"></a> last_task = task;
<a name="l503"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>3</span><span class=cF0>)
<a name="l504"></a> </span><span class=cF5>WinVert</span><span class=cF0>(task-&gt;win_top, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>, task);
<a name="l505"></a> i++;
<a name="l506"></a> }
<a name="l507"></a> task = task-&gt;last_task;
<a name="l508"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l509"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l510"></a>
<a name="l511"></a> </span><span class=cF5>WinVert</span><span class=cF0>(last_task-&gt;win_top, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>, last_task);
<a name="l512"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l513"></a>}
<a name="l514"></a>
<a name="l515"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinTileVert</span><span class=cF0>()
<a name="l516"></a>{</span><span class=cF2>//Tile windows vertically side-by-side.</span><span class=cF0>
<a name="l517"></a> </span><span class=cF9>CTask</span><span class=cF0> *task, *last_task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l518"></a> </span><span class=cF9>I64</span><span class=cF0> count, c, i, horz_size, no_border;
<a name="l519"></a>
<a name="l520"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l521"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l522"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
<a name="l523"></a> count = </span><span class=cFE>0</span><span class=cF0>;
<a name="l524"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l525"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l527"></a> count++;
<a name="l528"></a> task = task-&gt;last_task;
<a name="l529"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l530"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l531"></a>
<a name="l532"></a> task = </span><span class=cFB>sys_winmgr_task</span><span class=cF0>;
<a name="l533"></a> i = </span><span class=cFE>0</span><span class=cF0>;
<a name="l534"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l535"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l536"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;win_inhibit, </span><span class=cF3>WIf_SELF_FOCUS</span><span class=cF7>)</span><span class=cF0>)
<a name="l537"></a> {
<a name="l538"></a> no_border = </span><span class=cF5>Bt</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l539"></a> c = count - i &amp; ~</span><span class=cFE>3</span><span class=cF0>;
<a name="l540"></a> </span><span class=cF1>if</span><span class=cF0> (!c)
<a name="l541"></a> c = </span><span class=cFE>1</span><span class=cF0>;
<a name="l542"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (c &gt; </span><span class=cFE>4</span><span class=cF0>)
<a name="l543"></a> c = </span><span class=cFE>4</span><span class=cF0>;
<a name="l544"></a> horz_size = </span><span class=cF3>TEXT_COLS</span><span class=cF0> / c;
<a name="l545"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>i &amp; </span><span class=cFE>3</span><span class=cF7>)</span><span class=cF0> * horz_size + </span><span class=cFE>1</span><span class=cF0> - no_border, </span><span class=cF7>(</span><span class=cF0>i &amp; </span><span class=cFE>3</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * horz_size - </span><span class=cFE>1</span><span class=cF0> + no_border, task);
<a name="l546"></a> </span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0> - no_border, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> + no_border, task);
<a name="l547"></a> last_task = task;
<a name="l548"></a> </span><span class=cF1>if</span><span class=cF0> (i &amp; </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>3</span><span class=cF0>)
<a name="l549"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(task-&gt;win_left, </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>, task);
<a name="l550"></a> i++;
<a name="l551"></a> }
<a name="l552"></a> task = task-&gt;last_task;
<a name="l553"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l554"></a> </span><span class=cF1>while</span><span class=cF0> (task != </span><span class=cFB>sys_winmgr_task</span><span class=cF0>);
<a name="l555"></a>
<a name="l556"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(last_task-&gt;win_left, </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>, last_task);
<a name="l557"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l558"></a>}
<a name="l559"></a>
<a name="l560"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>WinMax</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l561"></a>{</span><span class=cF2>//Maximize task's window</span><span class=cF0>
<a name="l562"></a> </span><span class=cF9>I64</span><span class=cF0> no_border;
<a name="l563"></a>
<a name="l564"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l565"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l566"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l567"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l568"></a>
<a name="l569"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l570"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l571"></a> no_border = </span><span class=cF5>Bt</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l572"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0> - no_border, </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> + no_border, task);
<a name="l573"></a> </span><span class=cF5>WinVert</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0> - no_border, </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> + no_border, task);
<a name="l574"></a> </span><span class=cF5>WinToTop</span><span class=cF0>(task);
<a name="l575"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l576"></a>}
<a name="l577"></a>
<a name="l578"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>WinBorder</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> val = </span><span class=cF3>OFF</span><span class=cF0>, </span><span class=cF9>CTask</span><span class=cF0> *task = </span><span class=cF3>NULL</span><span class=cF0>)
<a name="l579"></a>{</span><span class=cF2>//Turn off (or on) window border.</span><span class=cF0>
<a name="l580"></a> </span><span class=cF1>Bool</span><span class=cF0> old_has_border;
<a name="l581"></a>
<a name="l582"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l583"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
<a name="l585"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l586"></a>
<a name="l587"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l588"></a> </span><span class=cF1>CLI</span><span class=cF0> </span><span class=cF2>//TODO Multiprocessor safe</span><span class=cF0>
<a name="l589"></a> old_has_border = !</span><span class=cF5>Bt</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l590"></a> </span><span class=cF1>if</span><span class=cF0> (val)
<a name="l591"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l592"></a> </span><span class=cF1>if</span><span class=cF0> (!old_has_border)
<a name="l593"></a> {
<a name="l594"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l595"></a> task-&gt;win_left++;
<a name="l596"></a> task-&gt;win_right--;
<a name="l597"></a> task-&gt;win_top++;
<a name="l598"></a> task-&gt;win_bottom--;
<a name="l599"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l600"></a> }
<a name="l601"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l602"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l603"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l604"></a> </span><span class=cF1>if</span><span class=cF0> (old_has_border) {
<a name="l605"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF0>);
<a name="l606"></a> task-&gt;win_left--;
<a name="l607"></a> task-&gt;win_right++;
<a name="l608"></a> task-&gt;win_top--;
<a name="l609"></a> task-&gt;win_bottom++;
<a name="l610"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(task, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l611"></a> }
<a name="l612"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l613"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l614"></a>
<a name="l615"></a> </span><span class=cF1>return</span><span class=cF0> old_has_border;
<a name="l616"></a>}
</span></pre></body>
</html>