Fix mouse event coordinates for single-line wxTextCtrl with GTK3
This commit is contained in:
@@ -59,6 +59,21 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
|
|||||||
event.m_x = (wxCoord)gdk_event->x - pt.x;
|
event.m_x = (wxCoord)gdk_event->x - pt.x;
|
||||||
event.m_y = (wxCoord)gdk_event->y - pt.y;
|
event.m_y = (wxCoord)gdk_event->y - pt.y;
|
||||||
|
|
||||||
|
// Some no-window widgets, notably GtkEntry on GTK3, have a GdkWindow
|
||||||
|
// covering part of their area. Event coordinates from that window are
|
||||||
|
// not relative to the widget, so do the conversion here.
|
||||||
|
if (!gtk_widget_get_has_window(win->m_widget) &&
|
||||||
|
gtk_widget_get_window(win->m_widget) == gdk_window_get_parent(gdk_event->window))
|
||||||
|
{
|
||||||
|
GtkAllocation a;
|
||||||
|
gtk_widget_get_allocation(win->m_widget, &a);
|
||||||
|
int posX, posY;
|
||||||
|
gdk_window_get_position(gdk_event->window, &posX, &posY);
|
||||||
|
|
||||||
|
event.m_x += posX - a.x;
|
||||||
|
event.m_y += posY - a.y;
|
||||||
|
}
|
||||||
|
|
||||||
if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
|
if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
|
||||||
{
|
{
|
||||||
// origin in the upper right corner
|
// origin in the upper right corner
|
||||||
|
Reference in New Issue
Block a user