Bug 105416 - Window is almost empty with GTK 3 and RTL UI
Summary: Window is almost empty with GTK 3 and RTL UI
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
5.3.0.1 rc
Hardware: All Linux (All)
: high major
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.4.0 target:5.3.1 target:5.2.6
Keywords:
Depends on:
Blocks: RTL-CTL GTK3
  Show dependency treegraph
 
Reported: 2017-01-18 15:36 UTC by ⁨خالد حسني⁩
Modified: 2017-10-15 23:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot (30.09 KB, image/png)
2017-01-18 15:37 UTC, ⁨خالد حسني⁩
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ⁨خالد حسني⁩ 2017-01-18 15:36:12 UTC
Description:
When running 5.3 or master with RTL UI and the default GTK 3 vcl plugin, the window is almost blank and only the menubar is shown. No problem with GTK 2.

Steps to Reproduce:
1. Run any module with SAL_RTL_ENABLED=1 en var or a RTL language.

Actual Results:  
Window is almost blank.

Expected Results:
Some stuff in the window.


Reproducible: Always

User Profile Reset: Yes

Additional Info:
I’m using a hidpi screen, might or might not be related but I can’t test on a non-hidpi one at the moment.


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 ⁨خالد حسني⁩ 2017-01-18 15:37:32 UTC
Created attachment 130530 [details]
Screenshot
Comment 2 Caolán McNamara 2017-01-18 15:57:52 UTC
you can probably lower your resolution out of the auto hidpi range, I find that it works at lower res and doesn't at 4k resolution hidpi, so its something related to that. some 16 bit overflow or something :-) ?
Comment 3 ⁨خالد حسني⁩ 2017-01-18 21:46:25 UTC
Still no idea what is going on, but creating a surface half the size will draw the left half just fine:

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d3a0310245f7..55cbdea37158 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1585,7 +1585,7 @@ void GtkSalFrame::AllocateFrame()
 #endif
         m_pSurface = gdk_window_create_similar_image_surface(widget_get_window(m_pWindow),
                                                              CAIRO_FORMAT_ARGB32,
-                                                             aFrameSize.getX() * scale,
+                                                             (aFrameSize.getX()/2) * scale,
                                                              aFrameSize.getY() * scale,
                                                              scale);
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)

But two thirds with draw only the left 1/3 in the middle of the screen!
Comment 4 ⁨خالد حسني⁩ 2017-01-18 23:26:58 UTC
My wild guess is that we are drawing starting from the right edge of the window/surface instead of the left one and all the drawings is now happening outside the window, or something like that.
Comment 5 Caolán McNamara 2017-01-19 10:00:51 UTC
I think I have it
Comment 6 Commit Notification 2017-01-19 10:03:31 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4e9cfc178c47893229f8030bfe73e2b7c5de92c3

Resolves: tdf#105416 blank windows under HiDPI RTL

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Caolán McNamara 2017-01-19 10:07:56 UTC
seems to work, hopefully there isn't side effects. backport in gerrit for 5.3
Comment 8 Commit Notification 2017-01-22 21:02:11 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c9ab894ae846185a0341656922b0aa1632bfe886&h=libreoffice-5-3

Resolves: tdf#105416 blank windows under HiDPI RTL

It will be available in 5.3.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2017-01-30 09:45:36 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f12d24b25994c22396d768160fe69364f1627459&h=libreoffice-5-2

Resolves: tdf#105416 blank windows under HiDPI RTL

It will be available in 5.2.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.