<html>
    <head>
      <base href="https://bugzilla.gnome.org/" />
    </head>
    <body><span class="vcard"><a href="page.cgi?id=describeuser.html&login=xovni%40wanadoo.fr" title="Guillaume Ayoub <xovni@wanadoo.fr>"> <span class="fn">Guillaume Ayoub</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Entry completion drop-down is misplaced on external monitor when on Wayland"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=774065">bug 774065</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #366081 status</td>
           <td>none
           </td>
           <td>needs-work
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Entry completion drop-down is misplaced on external monitor when on Wayland"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=774065#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Entry completion drop-down is misplaced on external monitor when on Wayland"
   href="https://bugzilla.gnome.org/show_bug.cgi?id=774065">bug 774065</a>
              from <span class="vcard"><a href="page.cgi?id=describeuser.html&login=xovni%40wanadoo.fr" title="Guillaume Ayoub <xovni@wanadoo.fr>"> <span class="fn">Guillaume Ayoub</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=366081&action=diff" name="attach_366081" title="Work-in-progress patch using gdk_window_move_to_rect instead of gtk_window_move">attachment 366081</a> <a href="attachment.cgi?id=366081&action=edit" title="Work-in-progress patch using gdk_window_move_to_rect instead of gtk_window_move">[details]</a></span> <a href='review?bug=774065&attachment=366081'>[review]</a>
Work-in-progress patch using gdk_window_move_to_rect instead of gtk_window_move

This patch replaces the gtk_window_move call with gdk_window_move_to_rect. It's
a patch for the gtk-3-22 branch.

**It's probably an awful patch because I write C less that once a year.
Moreover, I don't know GTK+ internal stuff at all.** But at least it's a start
:).

The patch lets GDK find the right position to display the entry completion
popup, instead of letting the GTK entry find the position itself. It fixes the
bug for Epiphany, the gtk-demo app and a custom testing Python app \o/.

Unfortunately, it doesn't work for Geary (where the position was broken anyway
for me), it puts the popup at (0, 6) pixels from the top-left-corner of the
window.

I did not test it on X.


Random thoughts:

- The popup used to be a subsurface, but subsurfaces cannot be moved using
gdk_window_move_to_rect. I don't know whether it's intended or not.

- Popup width and height are managed by the completion widget as they used to
be, as they "require" inner content logic (they depend on the tree-view and its
filtered results). They don't depend on the available screen area anymore.

- I had to call gtk_widget_show in gtk_entry_completion_popup. I don't know
why, I'm not sure it's the right place.

- gtk_widget_get_allocation is called twice on completion->priv->entry, but I
don't know how to cast allocation into a GdkRectangle :/.

- The tree-view is not scrolled to the last found item when the popup doesn't
fit below the entry and is put above. We could fix that by scrolling after
gdk_window_move_to_rect has been called.

- I've used dirty constants when calling gdk_window_move_to_rect. Maybe we can
remove the WEST part of the gravity constants, or flip them according to text
direction (that's what's done in menus).

- The popup position is different from the previous implementation. For
example, the popup was just below the text in the previous implementation, it's
now below the entry. Just telling, I suppose some people careā€¦</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>