Commits (3)
' Gambas class file
Export
Static Property Read Type As String
Static Property Read Types As String[]
Static Private $sDesktop As String
Static Private $aDesktopType As String[]
Static Private Sub GetDesktop() As String
If $sDesktop Then Return $sDesktop
If Not $aDesktopType Then
$aDesktopType = Split(Application.Env["XDG_CURRENT_DESKTOP"], ":")
$aDesktopType.ReadOnly = True
Endif
If $aDesktopType.Count = 0 Then
If Application.Env["KDE_FULL_SESSION"] Then
If Application.Env["KDE_SESSION_VERSION"] = "4" Then
$aDesktopType.Add("KDE4")
Else If Application.Env["KDE_SESSION_VERSION"] = "5" Then
$aDesktopType.Add("KDE5")
Endif
$aDesktopType.Add("KDE")
Else If Application.Env["GNOME_DESKTOP_SESSION_ID"] Then
$aDesktopType.Add("GNOME")
Else If Application.Env["MATE_DESKTOP_SESSION_ID"] Or If Application.Env["MATECORBA_SOCKETDIR"] Then
$aDesktopType.Add("MATE")
Else If Application.Env["E_BIN_DIR"] And If Application.Env["E_LIB_DIR"] Then
$aDesktopType.Add("ENLIGHTENMENT")
Else If Application.Env["WMAKER_BIN_NAME"] Then
$aDesktopType.Add("WINDOWMAKER")
Else If Application.Env["DESKTOP_SESSION"] = "LXDE" Then
$aDesktopType.Add("LXDE")
Else If UCase(Env["DESKTOP_SESSION"]) = "XCFE" Then
$aDesktopType.Add("XFCE")
Else If UCase(Env["XDG_MENU_PREFIX"]) Begins "XCFE" Then
$aDesktopType.Add("XFCE")
Else If InStr(Env["XDG_DATA_DIR"], "/xfce") Then
$aDesktopType.Add("XFCE")
Endif
Endif
$sDesktop = $aDesktopType[0]
If $sDesktop Begins "X-" Then $sDesktop = Mid$($sDesktop, 3)
Return $sDesktop
End
Static Private Function Type_Read() As String
Return GetDesktop()
End
Static Private Function Types_Read() As String[]
GetDesktop()
Return $aDesktopType
End
Static Public Sub Is(Type As String) As Boolean
Return Types_Read().Exist(Type, gb.IgnoreCase)
End
......@@ -34,7 +34,6 @@
#include "gapplication.h"
#include "gmainwindow.h"
#include "cpaint_impl.h"
#include "desktop.h"
extern int CWINDOW_Embedder;
extern bool CWINDOW_Embedded;
......@@ -161,12 +160,6 @@ BEGIN_PROPERTY(Desktop_Scale)
END_PROPERTY
BEGIN_PROPERTY(Desktop_Type)
GB.ReturnConstZeroString(DESKTOP_get_type());
END_PROPERTY
BEGIN_PROPERTY(Desktop_Platform)
#ifdef GTK3
......@@ -521,7 +514,6 @@ GB_DESC DesktopDesc[] =
GB_STATIC_METHOD("Screenshot", "Picture", Desktop_Screenshot, "[(X)i(Y)i(Width)i(Height)i]"),
GB_STATIC_PROPERTY_READ("Type", "s", Desktop_Type),
GB_STATIC_PROPERTY_READ("Platform", "s", Desktop_Platform),
GB_END_DECLARE
......
......@@ -77,7 +77,6 @@ gb_gtk_la_SOURCES = \
gprinter.h gprinter.cpp \
gglarea.h gglarea.cpp \
x11.h x11.c \
desktop.h desktop.c \
sm/bonobo-macros.h \
sm/gnome-macros.h \
sm/gnome-uidefs.h \
......
../../gb.qt4/src/desktop.c
\ No newline at end of file
../../gb.qt4/src/desktop.h
\ No newline at end of file
......@@ -33,7 +33,6 @@
#include "gkey.h"
#include "x11.h"
#include "desktop.h"
#include "CScreen.h"
#include "CStyle.h"
#include "CDraw.h"
......
......@@ -73,5 +73,4 @@ gb_gtk3_la_SOURCES = \
gclipboard.h \
gdrag.h gdrag.cpp \
gtools.h kentities.h \
gprinter.h gprinter.cpp \
desktop.h desktop.c
gprinter.h gprinter.cpp
../../gb.gtk/src/desktop.c
\ No newline at end of file
../../gb.gtk/src/desktop.h
\ No newline at end of file
......@@ -32,7 +32,6 @@
#include "watcher.h"
#include "gkey.h"
#include "desktop.h"
#include "CScreen.h"
#include "CStyle.h"
#include "CDraw.h"
......
......@@ -48,8 +48,6 @@
#include "x11.h"
#endif
#include "desktop.h"
#ifdef QT5
#define DESKTOP_INFO() (QGuiApplication::screens().front()->availableGeometry())
#define SCREEN_INFO(_id) (QGuiApplication::screens().at(_id)->geometry())
......@@ -176,12 +174,6 @@ BEGIN_PROPERTY(Desktop_Scale)
END_PROPERTY
BEGIN_PROPERTY(Desktop_Type)
GB.ReturnConstZeroString(DESKTOP_get_type());
END_PROPERTY
BEGIN_PROPERTY(Desktop_Platform)
GB.ReturnConstZeroString(MAIN_platform);
......@@ -564,7 +556,6 @@ GB_DESC DesktopDesc[] =
GB_STATIC_METHOD("Screenshot", "Picture", Desktop_Screenshot, "[(X)i(Y)i(Width)i(Height)i]"),
GB_STATIC_PROPERTY_READ("Type", "s", Desktop_Type),
GB_STATIC_PROPERTY_READ("Platform", "s", Desktop_Platform),
GB_END_DECLARE
......
......@@ -2570,7 +2570,9 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event)
if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick)
{
GB.GetTime(&timer, TRUE);
if (abs(mevent->globalX() - MOUSE_click_x) < 4 && abs(mevent->globalY() - MOUSE_click_y) < 4 && ((timer - MOUSE_timer) * 1000) < QApplication::doubleClickInterval())
if (((timer - MOUSE_timer) * 1000) < QApplication::doubleClickInterval()
&& abs(mevent->globalX() - MOUSE_click_x) < MAIN_scale
&& abs(mevent->globalY() - MOUSE_click_y) < MAIN_scale)
MOUSE_click_count++;
else
{
......@@ -3027,8 +3029,23 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event)
#endif
MOUSE_info.state = ev->buttons();
MOUSE_info.modifier = ev->modifiers();
#ifdef QT5
QPoint delta = ev->angleDelta();
if (delta.x())
{
MOUSE_info.orientation = Qt::Horizontal;
MOUSE_info.delta = delta.x();
}
else
{
MOUSE_info.orientation = Qt::Vertical;
MOUSE_info.delta = delta.y();
}
#else
MOUSE_info.orientation = ev->orientation();
MOUSE_info.delta = ev->delta();
#endif
cancel = GB.Raise(control, EVENT_MouseWheel, 0);
......
......@@ -14,7 +14,6 @@ gb_qt4_la_CPPFLAGS = @QT_INC@ -I$(top_srcdir)/share/
gb_qt4_la_SOURCES = \
x11.h x11.c \
desktop.h desktop.c \
gb.qt.h main.h main_moc.cpp main.cpp \
CFont.h CFont.cpp \
CScreen.h CScreen.cpp \
......
......@@ -12,7 +12,6 @@ gb_qt5_la_CXXFLAGS = @THREAD_INC@ -DGB_QT_COMPONENT $(AM_CXXFLAGS) -std=c++11
gb_qt5_la_CPPFLAGS = @QT5_INC@ -I$(top_srcdir)/share/
gb_qt5_la_SOURCES = \
desktop.h desktop.c \
gb.qt.h main.h main_moc.cpp main.cpp \
CFont.h CFont.cpp \
CScreen.h CScreen.cpp \
......
../../gb.qt4/src/desktop.c
\ No newline at end of file
../../gb.qt4/src/desktop.h
\ No newline at end of file
......@@ -91,7 +91,6 @@
#include "cpaint_impl.h"
#include "ctrayicon.h"
#include "desktop.h"
#include "gb.qt.platform.h"
#include "fix_style.h"
......