https://www.ultimatepp.org/redmine/https://www.ultimatepp.org/redmine/redmine/favicon.ico2014-03-17T15:46:35ZRedmineU++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15512014-03-17T15:46:35ZZbigniew Rebacz
<ul><li><strong>File</strong> <i>GtkWnd.cpp</i> added</li><li><strong>Status</strong> changed from <i>New</i> to <i>Patch ready</i></li></ul><p>It seems that this extension works since version 2.20.0: <a class="external" href="https://developer.gnome.org/gdk3/unstable/GdkScreen.html#gdk-screen-get-primary-monitor">https://developer.gnome.org/gdk3/unstable/GdkScreen.html#gdk-screen-get-primary-monitor</a>.</p>
<p>For me the easiest solution should look like this:<br /><pre>
Rect Ctrl::GetPrimaryWorkArea()
{
GuiLock __;
static Rect r;
if (r.right == 0) {
Array<Rect> rc;
GetWorkArea(rc);
#if GTK_CHECK_VERSION(2, 20, 0)
int primary = gdk_screen_get_primary_monitor(gdk_screen_get_default());
#else
int primary = 0;
#endif
primary >= 0 && primary < rc.GetCount() ? r = rc[primary] : r = GetVirtualScreenArea();
}
return r;
}
</pre></p>
<p>Please noticed that this patch will affect my uncomited patch: <a class="external" href="http://www.ultimatepp.org/redmine/issues/707#change-1522">http://www.ultimatepp.org/redmine/issues/707#change-1522</a>. So, I decided to included "latest" version of "GTKWnd.cpp".</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15522014-03-17T15:49:27ZZbigniew Rebacz
<ul><li><strong>File</strong> deleted (<del><i>GtkWnd.cpp</i></del>)</li></ul> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15532014-03-17T15:53:58ZZbigniew Rebacz
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/296/GtkWnd.cpp">GtkWnd.cpp</a><a href="/redmine/attachments/296/GtkWnd.cpp"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li><li><strong>File</strong> <i>X11App.cpp</i> added</li></ul><p>I think we can also improve a little bit X11 version of following method: "Rect Ctrl::GetPrimaryWorkArea()".</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15622014-03-23T15:47:43ZMiroslav Fidlercxl@ntllib.org
<ul><li><strong>Status</strong> changed from <i>Patch ready</i> to <i>Ready for CR</i></li><li><strong>Assignee</strong> changed from <i>Miroslav Fidler</i> to <i>Zbigniew Rebacz</i></li></ul><p>Applied, however:</p>
<p>GetWorkArea docs (and original intent) is that the area that the window belongs to is returned, not mouse position. This is also consistent with Win32 behaviour.</p>
<p>Therefore, I have (and in X11 too) done this change:</p>
<p>[code]<br />Rect Ctrl::GetWorkArea() const
{<br /> GuiLock __;<br /> static Array<Rect> rc;<br /> if(rc.IsEmpty()) <br /> GetWorkArea(rc);</p>
<pre><code>Point pt = GetScreenRect().TopLeft();<br /> for (int i = 0; i < rc.GetCount(); i++)<br /> if(rc[i].Contains(pt))<br /> return rc[i];<br /> return GetPrimaryWorkArea();<br />}<br />[/code]</code></pre>
<p>I know that this is not bulletproof either (I guess window can be on more screens), but at least it follow original U++ docs (written at the time of adding this in Win32).</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15662014-03-24T00:38:38ZZbigniew Rebacz
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/300/X11App.cpp">X11App.cpp</a><a href="/redmine/attachments/300/X11App.cpp"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li><li><strong>Assignee</strong> changed from <i>Zbigniew Rebacz</i> to <i>Miroslav Fidler</i></li></ul><p>It seems that TopWindow::CenterRect for X11 needs improvement. It seems that it is not ready for GetScreenRect(). (X11Top.cpp)</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15672014-03-24T09:25:41ZMiroslav Fidlercxl@ntllib.org
<ul><li><strong>Status</strong> changed from <i>Ready for CR</i> to <i>Approved</i></li></ul> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15682014-03-24T11:35:27ZZbigniew Rebacz
<ul><li><strong>File</strong> deleted (<del><i>X11Top.cpp</i></del>)</li></ul> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15702014-03-24T11:56:06ZZbigniew Rebacz
<ul><li><strong>Status</strong> changed from <i>Approved</i> to <i>Ready for CR</i></li></ul><p>In my opinion "GetRect().TopLeft()" is not perfect solution, because it causes several problems like tool tips are show only on one screen or similar error with "DisplayPopup" (It can be seen in ArrayCtrl).</p>
<p>For me the most stable and user friendly solution is to check absolute mouse possition on both platforms X11 & GTK. Moreover it gaves the best results for tool tips (They are always fit to current screen even if the window is on the edge between two screen). Maybe we should implemented similar solution on M$ Windows.</p>
<p>For the end I would like to write that I am almost sure that GetWorkArea() should return dynamic results. Mouse possition seems to be most resonable.</p>
<p>// <strong>**</strong><br />If you decided to use my solution, please patch also X11Top.cpp (line 254 GetVirtualScreenArea() -> GetWorkArea()).</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15742014-03-24T19:45:59ZMiroslav Fidlercxl@ntllib.org
<ul></ul><p>Well, but perhaps it is then rather error of DisplayPopup or tips. I mean, perhaps they should rather find proper work area based on mouse position, but meanwhile current method should stay as it is...</p>
<p>Mirek</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15752014-03-28T22:11:20ZZbigniew Rebacz
<ul></ul><p>For me, we can now close this bug. It seems to me that now I understand the design. I understand that we need also patch "Display Popup" & "ToolTip". (I will create new bug report for this issues)</p>
<p>I have got one question. What about Windows version of method "GetWorkArea"? For me the implementation is strange and probably incompatible with the upp documentation.<br /><pre><code class="cpp syntaxhl"><span class="CodeRay">Rect Ctrl::GetWorkArea() <span class="directive">const</span>
{
<span class="comment">// return MonitorRectForHWND(GetHWND());</span>
<span class="comment">// mst:2008-12-08, hack for better multimonitor support.</span>
GuiLock __;
<span class="directive">const</span> Ctrl *topctl = GetTopCtrl();
HWND hwnd = topctl->GetHWND();
<span class="keyword">if</span>(!hwnd && !((topctl = topctl->GetOwnerCtrl()) && (hwnd = topctl->GetHWND())))
hwnd = ::GetFocus();
<span class="keyword">return</span> MonitorRectForHWND(hwnd);
}
</span></code><br /></pre></p>
<p>For me the implementation of "GetWorkArea" should works exactly the same on all platforms.</p>
<p>Last but not least is thing that you can remove "SyncMousePos()" from "GetWorkArea" implementation on X11 (line 538). It is not needed anymore.</p> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15762014-03-28T22:11:30ZZbigniew Rebacz
<ul><li><strong>File</strong> deleted (<del><i>X11App.cpp</i></del>)</li></ul> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=15772014-03-28T22:12:10ZZbigniew Rebacz
<ul><li><strong>File</strong> <a href="/redmine/attachments/download/300/X11App.cpp">X11App.cpp</a><a href="/redmine/attachments/300/X11App.cpp"><img alt="Magnifier" src="/redmine/images/magnifier.png" /></a> added</li></ul> U++ - Bug #725: gdk_screen_get_primary_monitor only works with GTK>=2.19.2https://www.ultimatepp.org/redmine/issues/725?journal_id=16222014-05-16T06:20:14ZMiroslav Fidlercxl@ntllib.org
<ul><li><strong>Status</strong> changed from <i>Ready for CR</i> to <i>Approved</i></li></ul>