Application.MiddleClickPaste is a new property that tells if middle click should paste.

[GB.GTK]
* NEW: Application.MiddleClickPaste is a new property that tells if middle click should paste.
  The global GTK+ settings is taken into account at application startup.

[GB.GTK3]
* NEW: Application.MiddleClickPaste is a new property that tells if middle click should paste.
  The global GTK+ settings is taken into account at application startup.

[GB.QT4]
* NEW: Application.MiddleClickPaste is a new property that tells if middle click should paste.

[GB.QT5]
* NEW: Application.MiddleClickPaste is a new property that tells if middle click should paste.
This commit is contained in:
Benoît Minisini 2022-12-27 22:15:50 +01:00
parent 5f74a100e8
commit fcef1adabf
4 changed files with 48 additions and 1 deletions

View file

@ -50,6 +50,7 @@ static CSCREEN *_screens[MAX_SCREEN] = { NULL };
static bool _animations = FALSE;
static bool _shadows = FALSE;
static bool _middle_click_paste = TRUE;
//-------------------------------------------------------------------------
@ -261,6 +262,16 @@ BEGIN_PROPERTY(Application_Animations)
END_PROPERTY
BEGIN_PROPERTY(Application_MiddleClickPaste)
if (READ_PROPERTY)
GB.ReturnBoolean(_middle_click_paste);
else
_middle_click_paste = VPROP(GB_BOOLEAN);
END_PROPERTY
BEGIN_PROPERTY(Application_Shadows)
if (READ_PROPERTY)
@ -287,6 +298,13 @@ BEGIN_PROPERTY(Application_MainWindow)
END_PROPERTY
BEGIN_METHOD_VOID(Application_init)
_middle_click_paste = gApplication::hasMiddleClickPaste();
END_METHOD
BEGIN_METHOD_VOID(Application_exit)
GB.FreeString(&CAPPLICATION_Theme);
@ -523,6 +541,7 @@ GB_DESC ApplicationDesc[] =
{
GB_DECLARE("Application", 0), GB_VIRTUAL_CLASS(),
GB_STATIC_METHOD("_init", NULL, Application_init, 0),
GB_STATIC_METHOD("_exit", NULL, Application_exit, 0),
GB_STATIC_PROPERTY("Font", "Font", Application_Font),
@ -534,6 +553,7 @@ GB_DESC ApplicationDesc[] =
GB_STATIC_PROPERTY("ShowTooltips", "b", Application_ShowTooltips),
GB_STATIC_PROPERTY("Animations", "b", Application_Animations),
GB_STATIC_PROPERTY("Shadows", "b", Application_Shadows),
GB_STATIC_PROPERTY("MiddleClickPaste", "b", Application_MiddleClickPaste),
GB_STATIC_PROPERTY("Embedder", "i", Application_Embedder),
GB_STATIC_PROPERTY("Theme", "s", Application_Theme),
GB_STATIC_PROPERTY_READ("DarkTheme", "s", Application_DarkTheme),

View file

@ -1808,3 +1808,16 @@ bool gApplication::eventsPending()
return gtk_events_pending();
}
bool gApplication::hasMiddleClickPaste()
{
gboolean enabled;
GtkSettings *settings;
settings = gtk_settings_get_default();
g_object_get(settings, "gtk-enable-primary-paste", &enabled, (char *)NULL);
return enabled;
}

View file

@ -52,8 +52,10 @@ public:
static void setActiveControl(gControl *control, bool on);
static void finishFocus();
static void enableTooltips(bool vl);
static bool areTooltipsEnabled();
static void enableTooltips(bool vl);
static bool hasMiddleClickPaste();
static int dblClickTime();

View file

@ -74,6 +74,7 @@ static CSCREEN *_screens[MAX_SCREEN] = { NULL };
static bool _animations = FALSE;
static bool _shadows = FALSE;
static bool _middle_click_paste = TRUE;
static CSCREEN *get_screen(int num)
{
@ -276,6 +277,16 @@ BEGIN_PROPERTY(Application_Animations)
END_PROPERTY
BEGIN_PROPERTY(Application_MiddleClickPaste)
if (READ_PROPERTY)
GB.ReturnBoolean(_middle_click_paste);
else
_middle_click_paste = VPROP(GB_BOOLEAN);
END_PROPERTY
BEGIN_PROPERTY(Application_Shadows)
if (READ_PROPERTY)
@ -574,6 +585,7 @@ GB_DESC ApplicationDesc[] =
GB_STATIC_PROPERTY("Busy", "i", Application_Busy),
GB_STATIC_PROPERTY("ShowTooltips", "b", Application_ShowTooltips),
GB_STATIC_PROPERTY("Animations", "b", Application_Animations),
GB_STATIC_PROPERTY("MiddleClickPaste", "b", Application_MiddleClickPaste),
GB_STATIC_PROPERTY("Shadows", "b", Application_Shadows),
GB_STATIC_PROPERTY("Embedder", "i", Application_Embedder),
GB_STATIC_PROPERTY("Theme", "s", Application_Theme),