68BEGIN_IGRAPHICS_NAMESPACE
78 void ForceEndUserEdit()
override;
86 int GetX11Fd()
const {
return mDisplay ? XConnectionNumber(mDisplay) : -1; }
93 mHostDriven = hostDriven;
104 void RequestWindowClose() { mCloseRequested =
true; }
105 bool IsInPlatformCallback()
const {
return mDispatchDepth != 0; }
107 void PlatformResize(
bool parentHasResized)
override;
115 void HideMouseCursor(
bool hide,
bool lock)
override;
116 void MoveMouseCursor(
float x,
float y)
override;
117 ECursor SetMouseCursor(ECursor cursorType)
override;
119 void GetMouseLocation(
float& x,
float& y)
const override;
121 EMsgBoxResult ShowMessageBox(
const char* str,
const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler)
override;
123 void* OpenWindow(
void* pParent)
override;
124 void CloseWindow()
override;
125 bool WindowIsOpen()
override {
return mPlugWnd != 0; }
127 void UpdateTooltips()
override;
129 bool RevealPathInExplorerOrFinder(WDL_String& path,
bool select)
override;
130 void PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action,
const char* ext, IFileDialogCompletionHandlerFunc completionHandler)
override;
131 void PromptForDirectory(WDL_String& dir, IFileDialogCompletionHandlerFunc completionHandler)
override;
132 bool PromptForColor(
IColor& color,
const char* str, IColorPickerHandlerFunc func)
override;
134 bool OpenURL(
const char* url,
const char* msgWindowTitle,
const char* confirmMsg,
const char* errMsgOnFailure)
override;
136 void* GetWindow()
override {
return (
void*)(uintptr_t)mPlugWnd; }
138 const char* GetPlatformAPIStr()
override {
return "x11"; }
140 bool GetTextFromClipboard(WDL_String& str)
override;
141 bool SetTextInClipboard(
const char* str)
override;
145 void CreatePlatformTextEntry(
int paramIdx,
const IText& text,
const IRECT& bounds,
int length,
const char* str)
override;
148#if defined IGRAPHICS_SKIA && defined IGRAPHICS_CPU
149 void PresentCPUFrame(
const SkPixmap& pixels)
override;
150 void DestroyCPUImage();
151 XImage* mCPUImage =
nullptr;
155 void CalculateHostResize(
int width,
int height,
int& designWidth,
int& designHeight,
float& scale);
158 explicit DispatchScope(std::atomic<int>& depth)
163 ~DispatchScope() { --mDepth; }
164 std::atomic<int>& mDepth;
167 void DispatchX11Events();
168 void DispatchKeyEvent(XKeyEvent& event);
169 void CreateInputContext();
170 void DestroyInputContext();
173 void ShowTooltip(
float x,
float y);
175 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fileNameOrResID)
override;
176 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fontName, ETextStyle style)
override;
177 PlatformFontPtr LoadPlatformFont(
const char* fontID,
void* pData,
int dataSize)
override;
178 void CachePlatformFont(
const char* fontID,
const PlatformFontPtr& font)
override;
180 void ActivateGLContext()
override;
181 void DeactivateGLContext()
override;
183 struct GLContextState
187 unsigned long drawable;
188 unsigned long readDrawable;
190 std::vector<GLContextState> mGLContextStack;
192 void* CreateGdkButtonPressEvent(
void* gtkHandle,
void* gdkDisplay,
void* gdkWindow,
int gdkScale);
193 void ReleaseX11PointerGrab();
194 XVisualInfo* CreateGLContext();
195 void DestroyGLContext();
196 void* mGLContext =
nullptr;
197 Colormap mGLColormap = 0;
199 Display* mDisplay =
nullptr;
200 XIM mInputMethod =
nullptr;
201 XIC mInputContext =
nullptr;
203 Window mParentWnd = 0;
204 Atom mWMDeleteMessage = 0;
205 Atom mXdndAware = 0, mXdndEnter = 0, mXdndPosition = 0, mXdndStatus = 0;
206 Atom mXdndLeave = 0, mXdndDrop = 0, mXdndFinished = 0, mXdndSelection = 0;
207 Atom mXdndTypeList = 0, mXdndActionCopy = 0, mUriList = 0, mDropProperty = 0;
208 Window mDragSource = 0;
209 bool mDragSupported =
false;
210 float mDropX = 0.f, mDropY = 0.f;
211 Window mTooltipWindow = 0;
212 XFontSet mTooltipFont =
nullptr;
213 int mTooltipControl = -1;
214 float mTooltipX = 0.f, mTooltipY = 0.f;
215 unsigned long mTooltipHoverTime = 0;
216 bool mInputMethodDisconnected =
false;
217 bool mTimerRunning =
false;
219 float mHiddenCursorX = 0.f;
220 float mHiddenCursorY = 0.f;
221 Cursor mBlankCursor = 0;
222 bool mNeedsRedraw =
false;
223 std::atomic<bool> mCloseRequested{
false};
224 std::atomic<int> mDispatchDepth{0};
225 unsigned long mLastLeftClickTime = 0;
227 unsigned long mLastPressTime = 0;
228 unsigned int mLastPressButton = 0;
229 int mLastPressX = 0, mLastPressY = 0, mLastPressRootX = 0, mLastPressRootY = 0;
230 float mLastLeftClickX = 0.f;
231 float mLastLeftClickY = 0.f;
234 Atom mClipboardAtom = 0;
235 Atom mUTF8StringAtom = 0;
236 Atom mSelDataAtom = 0;
238 bool mHostDriven =
false;
239 bool mInConfigureNotify =
false;
244 std::unique_ptr<Timer> mMainLoopTimer;
247END_IGRAPHICS_NAMESPACE
Used for choosing a drawing backend.
Platform timer primitives.
An editor delegate base class that uses IGraphics for the UI.
IGraphics platform class for Linux.
void ProcessX11Events()
Called by CLAP host posix-fd callback to drain pending X11 events.
int GetX11Fd() const
Returns the X11 display file descriptor, or -1 if not open.
void SetScreenScaleFromHost(float scale)
Apply a new host scale without interpreting older native sizes at the new scale.
void ResizeFromHost(int width, int height)
Apply a host/X11 size in physical pixels, preserving the configured resize mode.
float GetPlatformWindowScale() const override
Returns the screen scale factor so that requestResize() and OnParentWindowResize() pass physical pixe...
void ConstrainHostResize(int &width, int &height)
Constrain a proposed host size in physical pixels without resizing the editor.
bool WindowCloseRequested() const
A native close is completed by the owner after X11 dispatch returns.
void OnDisplayTimer()
Called by CLAP host timer callback to advance one display frame.
void SetHostDriven(bool hostDriven)
When host-driven = true the internal timer is suppressed.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...