diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-03-06 21:08:59 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-03-06 21:23:21 +0400 |
commit | f04fd5007310bd36fa4b582e1079cdd51adf12db (patch) | |
tree | 01668916304c4b187acde292957b8caaec27d41f /intern/ghost | |
parent | d916cedb4f20927591d1866468505aa1b10782e9 (diff) |
Fix X11 mouse cursor flickering briefly to the standard cursor when changing it.
Not very visible now but it matters for the next commit.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index c32b2727c4c..29ba1ff13e7 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -183,7 +183,8 @@ GHOST_WindowX11( m_valid_setup(false), m_invalid_window(false), m_empty_cursor(None), - m_custom_cursor(None) + m_custom_cursor(None), + m_visible_cursor(None) { /* Set up the minimum atrributes that we require and see if @@ -1361,7 +1362,10 @@ setWindowCursorVisibility( Cursor xcursor; if (visible) { - xcursor = getStandardCursor(getCursorShape() ); + if (m_visible_cursor) + xcursor = m_visible_cursor; + else + xcursor = getStandardCursor(getCursorShape() ); } else { xcursor = getEmptyCursor(); @@ -1424,6 +1428,8 @@ setWindowCursorShape( GHOST_TStandardCursor shape) { Cursor xcursor = getStandardCursor(shape); + + m_visible_cursor = xcursor; XDefineCursor(m_display, m_window, xcursor); XFlush(m_display); @@ -1473,6 +1479,8 @@ setWindowCustomCursorShape( m_custom_cursor = XCreatePixmapCursor(m_display, bitmap_pix, mask_pix, &fg, &bg, hotX, hotY); XDefineCursor(m_display, m_window, m_custom_cursor); XFlush(m_display); + + m_visible_cursor = m_custom_cursor; XFreePixmap(m_display, bitmap_pix); XFreePixmap(m_display, mask_pix); diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 7cbdcdeec21..afe21b0ffce 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -373,6 +373,9 @@ private: /** XCursor structure of the custom cursor */ Cursor m_custom_cursor; + + /** XCursor to show when cursor is visible */ + Cursor m_visible_cursor; /** Cache of XC_* ID's to XCursor structures */ std::map<unsigned int, Cursor> m_standard_cursors; |