Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
06cb0e6d
Kaydet (Commit)
06cb0e6d
authored
May 21, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
gtk3: implement keyboard and mouse grab
Change-Id: Iff17dccc58e0fcd6bdc479e6135e067ae375dce9
üst
b8f4b28c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
65 deletions
+73
-65
gtksalframe.cxx
vcl/unx/gtk/window/gtksalframe.cxx
+73
-65
No files found.
vcl/unx/gtk/window/gtksalframe.cxx
Dosyayı görüntüle @
06cb0e6d
...
@@ -2726,90 +2726,98 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
...
@@ -2726,90 +2726,98 @@ void GtkSalFrame::SetPointer( PointerStyle ePointerStyle )
void
GtkSalFrame
::
grabPointer
(
bool
bGrab
,
bool
bOwnerEvents
)
void
GtkSalFrame
::
grabPointer
(
bool
bGrab
,
bool
bOwnerEvents
)
{
{
#if !GTK_CHECK_VERSION(3,0,0)
static
const
char
*
pEnv
=
getenv
(
"SAL_NO_MOUSEGRABS"
);
static
const
char
*
pEnv
=
getenv
(
"SAL_NO_MOUSEGRABS"
);
if
(
pEnv
&&
*
pEnv
)
return
;
if
(
m_pWindow
)
if
(
!
m_pWindow
)
return
;
const
int
nMask
=
(
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_POINTER_MOTION_MASK
|
GDK_POINTER_MOTION_HINT_MASK
);
#if GTK_CHECK_VERSION(3,0,0)
GdkDeviceManager
*
pDeviceManager
=
gdk_display_get_device_manager
(
getGdkDisplay
());
GdkDevice
*
pPointer
=
gdk_device_manager_get_client_pointer
(
pDeviceManager
);
if
(
bGrab
)
gdk_device_grab
(
pPointer
,
widget_get_window
(
m_pWindow
),
GDK_OWNERSHIP_NONE
,
bOwnerEvents
,
(
GdkEventMask
)
nMask
,
m_pCurrentCursor
,
GDK_CURRENT_TIME
);
else
gdk_device_ungrab
(
pPointer
,
GDK_CURRENT_TIME
);
#else
if
(
bGrab
)
{
{
if
(
bGrab
)
bool
bUseGdkGrab
=
true
;
const
std
::
list
<
SalFrame
*
>&
rFrames
=
getDisplay
()
->
getFrames
();
for
(
std
::
list
<
SalFrame
*
>::
const_iterator
it
=
rFrames
.
begin
();
it
!=
rFrames
.
end
();
++
it
)
{
{
bool
bUseGdkGrab
=
true
;
const
GtkSalFrame
*
pFrame
=
static_cast
<
const
GtkSalFrame
*
>
(
*
it
);
const
std
::
list
<
SalFrame
*
>&
rFrames
=
getDisplay
()
->
getFrames
();
if
(
pFrame
->
m_bWindowIsGtkPlug
)
for
(
std
::
list
<
SalFrame
*
>::
const_iterator
it
=
rFrames
.
begin
();
it
!=
rFrames
.
end
();
++
it
)
{
const
GtkSalFrame
*
pFrame
=
static_cast
<
const
GtkSalFrame
*
>
(
*
it
);
if
(
pFrame
->
m_bWindowIsGtkPlug
)
{
bUseGdkGrab
=
false
;
break
;
}
}
if
(
bUseGdkGrab
)
{
const
int
nMask
=
(
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_RELEASE_MASK
|
GDK_POINTER_MOTION_MASK
|
GDK_POINTER_MOTION_HINT_MASK
);
if
(
!
pEnv
||
!*
pEnv
)
gdk_pointer_grab
(
widget_get_window
(
m_pWindow
),
bOwnerEvents
,
(
GdkEventMask
)
nMask
,
NULL
,
m_pCurrentCursor
,
GDK_CURRENT_TIME
);
}
else
{
{
// FIXME: for some unknown reason gdk_pointer_grab does not
bUseGdkGrab
=
false
;
// really produce owner events for GtkPlug windows
break
;
// the cause is yet unknown
// this is of course a bad hack, especially as we cannot
// set the right cursor this way
if
(
!
pEnv
||
!*
pEnv
)
XGrabPointer
(
getDisplay
()
->
GetDisplay
(),
widget_get_xid
(
m_pWindow
),
bOwnerEvents
,
PointerMotionMask
|
ButtonPressMask
|
ButtonReleaseMask
,
GrabModeAsync
,
GrabModeAsync
,
None
,
None
,
CurrentTime
);
}
}
}
}
if
(
bUseGdkGrab
)
{
gdk_pointer_grab
(
widget_get_window
(
m_pWindow
),
bOwnerEvents
,
(
GdkEventMask
)
nMask
,
NULL
,
m_pCurrentCursor
,
GDK_CURRENT_TIME
);
}
else
else
{
{
// Two GdkDisplays may be open
// FIXME: for some unknown reason gdk_pointer_grab does not
if
(
!
pEnv
||
!*
pEnv
)
// really produce owner events for GtkPlug windows
{
// the cause is yet unknown
gdk_display_pointer_ungrab
(
getGdkDisplay
(),
GDK_CURRENT_TIME
);
}
// this is of course a bad hack, especially as we cannot
// set the right cursor this way
XGrabPointer
(
getDisplay
()
->
GetDisplay
(),
widget_get_xid
(
m_pWindow
),
bOwnerEvents
,
PointerMotionMask
|
ButtonPressMask
|
ButtonReleaseMask
,
GrabModeAsync
,
GrabModeAsync
,
None
,
None
,
CurrentTime
);
}
}
}
}
#else
else
(
void
)
this
;
// loplugin:staticmethods
{
(
void
)
bGrab
;
(
void
)
bOwnerEvents
;
// Two GdkDisplays may be open
//FIXME: No GrabPointer implementation for gtk3 ...
gdk_display_pointer_ungrab
(
getGdkDisplay
(),
GDK_CURRENT_TIME
);
}
#endif
#endif
}
}
void
GtkSalFrame
::
grabKeyboard
(
bool
bGrab
)
void
GtkSalFrame
::
grabKeyboard
(
bool
bGrab
)
{
{
#if !GTK_CHECK_VERSION(3,0,0)
if
(
!
m_pWindow
)
if
(
m_pWindow
)
return
;
#if GTK_CHECK_VERSION(3,0,0)
GdkDeviceManager
*
pDeviceManager
=
gdk_display_get_device_manager
(
getGdkDisplay
());
GdkDevice
*
pPointer
=
gdk_device_manager_get_client_pointer
(
pDeviceManager
);
GdkDevice
*
pKeyboard
=
gdk_device_get_associated_device
(
pPointer
);
if
(
bGrab
)
{
{
if
(
bGrab
)
gdk_device_grab
(
pKeyboard
,
widget_get_window
(
m_pWindow
),
GDK_OWNERSHIP_NONE
,
{
FALSE
,
(
GdkEventMask
)(
GDK_KEY_PRESS
|
GDK_KEY_RELEASE
),
NULL
,
GDK_CURRENT_TIME
);
gdk_keyboard_grab
(
widget_get_window
(
m_pWindow
),
true
,
}
GDK_CURRENT_TIME
);
else
}
{
else
gdk_device_ungrab
(
pKeyboard
,
GDK_CURRENT_TIME
);
{
gdk_keyboard_ungrab
(
GDK_CURRENT_TIME
);
}
}
}
#else
#else
(
void
)
this
;
// loplugin:staticmethods
if
(
bGrab
)
(
void
)
bGrab
;
{
//FIXME: No GrabKeyboard implementation for gtk3 ...
gdk_keyboard_grab
(
widget_get_window
(
m_pWindow
),
true
,
GDK_CURRENT_TIME
);
}
else
{
gdk_keyboard_ungrab
(
GDK_CURRENT_TIME
);
}
#endif
#endif
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment