LMMS
Loading...
Searching...
No Matches
x11.c File Reference
#include "x11.h"
#include "attributes.h"
#include "internal.h"
#include "platform.h"
#include "types.h"
#include "pugl/pugl.h"
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <sys/select.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

Macros

#define MIN(a, b)
#define MAX(a, b)
#define PUGL_INIT_STRUCT
#define NUM_CURSORS   ((unsigned)PUGL_CURSOR_ANTI_DIAGONAL + 1u)

Enumerations

enum  WmClientStateMessageAction { WM_STATE_REMOVE , WM_STATE_ADD , WM_STATE_TOGGLE }

Functions

static bool initXSync (PuglWorldInternals *const impl)
static double puglX11GetDisplayScaleFactor (Display *const display)
PuglWorldInternalspuglInitWorldInternals (const PuglWorldType type, const PuglWorldFlags flags)
 Allocate and initialise world internals (implemented once per platform).
voidpuglGetNativeWorld (PuglWorld *const world)
PuglInternalspuglInitViewInternals (PuglWorld *const world)
 Allocate and initialise view internals (implemented once per platform).
static PuglStatus pollX11Socket (PuglWorld *const world, const double timeout)
static PuglViewfindView (PuglWorld *const world, const Window window)
static PuglStatus updateSizeHints (const PuglView *const view)
PuglStatus puglRealize (PuglView *const view)
PuglStatus puglShow (PuglView *const view)
PuglStatus puglHide (PuglView *const view)
 Hide the current window.
static void clearX11Clipboard (PuglX11Clipboard *const board)
void puglFreeViewInternals (PuglView *const view)
 Destroy and free view internals (implemented once per platform).
void puglFreeWorldInternals (PuglWorld *const world)
 Destroy and free world internals (implemented once per platform).
static PuglKey keySymToSpecial (const KeySym sym)
static int lookupString (XIC xic, XEvent *const xevent, char *const str, KeySym *const sym)
static void translateKey (PuglView *const view, XEvent *const xevent, PuglEvent *const event)
static uint32_t translateModifiers (const unsigned xstate)
static PuglStatus getAtomProperty (PuglView *const view, const Window window, const Atom property, unsigned long *numValues, Atom **values)
static PuglX11ClipboardgetX11SelectionClipboard (PuglView *const view, const Atom selection)
static void setClipboardFormats (PuglView *const view, PuglX11Clipboard *const board, const unsigned long numFormats, const Atom *const formats)
static PuglEvent translateClientMessage (PuglView *const view, XClientMessageEvent message)
static PuglEvent translatePropertyNotify (PuglView *const view, XPropertyEvent message)
static PuglEvent translateEvent (PuglView *const view, XEvent xevent)
PuglStatus puglGrabFocus (PuglView *const view)
bool puglHasFocus (const PuglView *const view)
 Return whether View has the keyboard input focus.
PuglStatus puglRequestAttention (PuglView *const view)
PuglStatus puglStartTimer (PuglView *const view, const uintptr_t id, const double timeout)
PuglStatus puglStopTimer (PuglView *const view, const uintptr_t id)
static XEvent eventToX (PuglView *const view, const PuglEvent *const event)
PuglStatus puglSendEvent (PuglView *const view, const PuglEvent *const event)
PuglStatus puglWaitForEvent (PuglView *const view)
static void mergeExposeEvents (PuglExposeEvent *const dst, const PuglExposeEvent *const src)
static PuglStatus retrieveSelection (const PuglWorld *const world, PuglView *const view, const Atom property, const Atom type, PuglBlob *const result)
static void handleSelectionNotify (const PuglWorld *const world, PuglView *const view, const XSelectionEvent *const event)
static PuglStatus handleSelectionRequest (const PuglWorld *const world, PuglView *const view, const XSelectionRequestEvent *const request)
static PUGL_WARN_UNUSED_RESULT PuglStatus flushExposures (PuglWorld *const world)
 Flush pending configure and expose events for all views.
static bool handleTimerEvent (PuglWorld *const world, const XEvent xevent)
static PuglStatus dispatchCurrentConfiguration (PuglView *const view)
static PuglStatus dispatchX11Events (PuglWorld *const world)
PuglStatus puglProcessEvents (PuglView *const view)
PuglStatus puglUpdate (PuglWorld *const world, const double timeout)
double puglGetTime (const PuglWorld *const world)
PuglStatus puglPostRedisplay (PuglView *const view)
PuglStatus puglPostRedisplayRect (PuglView *const view, const PuglRect rect)
PuglNativeView puglGetNativeView (PuglView *const view)
 Return the native window handle.
PuglStatus puglSetWindowTitle (PuglView *const view, const char *const title)
double puglGetScaleFactor (const PuglView *const view)
PuglStatus puglSetFrame (PuglView *const view, const PuglRect frame)
PuglStatus puglSetPosition (PuglView *const view, const int x, const int y)
PuglStatus puglSetSize (PuglView *const view, const unsigned width, const unsigned height)
PuglStatus puglSetSizeHint (PuglView *const view, const PuglSizeHint hint, const PuglSpan width, const PuglSpan height)
PuglStatus puglSetTransientParent (PuglView *const view, const PuglNativeView parent)
const voidpuglGetClipboard (PuglView *const view, const uint32_t typeIndex, size_t *const len)
PuglStatus puglAcceptOffer (PuglView *const view, const PuglDataOfferEvent *const offer, const uint32_t typeIndex)
PuglStatus puglPaste (PuglView *const view)
uint32_t puglGetNumClipboardTypes (const PuglView *const view)
const char * puglGetClipboardType (const PuglView *const view, const uint32_t typeIndex)
PuglStatus puglSetClipboard (PuglView *const view, const char *const type, const void *const data, const size_t len)
PuglStatus puglSetCursor (PuglView *const view, const PuglCursor cursor)
PuglStatus puglX11Configure (PuglView *view)

Macro Definition Documentation

◆ MAX

#define MAX ( a,
b )
Value:
(((a) > (b)) ? (a) : (b))
uint8_t a
Definition Spc_Cpu.h:141
b
Definition crypt.c:628

◆ MIN

#define MIN ( a,
b )
Value:
(((a) < (b)) ? (a) : (b))

◆ NUM_CURSORS

#define NUM_CURSORS   ((unsigned)PUGL_CURSOR_ANTI_DIAGONAL + 1u)

◆ PUGL_INIT_STRUCT

#define PUGL_INIT_STRUCT
Value:
{ \
0 \
}

Enumeration Type Documentation

◆ WmClientStateMessageAction

Enumerator
WM_STATE_REMOVE 
WM_STATE_ADD 
WM_STATE_TOGGLE 

Function Documentation

◆ clearX11Clipboard()

void clearX11Clipboard ( PuglX11Clipboard *const board)
static

◆ dispatchCurrentConfiguration()

PuglStatus dispatchCurrentConfiguration ( PuglView *const view)
static

◆ dispatchX11Events()

PuglStatus dispatchX11Events ( PuglWorld *const world)
static

◆ eventToX()

XEvent eventToX ( PuglView *const view,
const PuglEvent *const event )
static

◆ findView()

PuglView * findView ( PuglWorld *const world,
const Window window )
static

◆ flushExposures()

PUGL_WARN_UNUSED_RESULT PuglStatus flushExposures ( PuglWorld *const world)
static

Flush pending configure and expose events for all views.

◆ getAtomProperty()

PuglStatus getAtomProperty ( PuglView *const view,
const Window window,
const Atom property,
unsigned long * numValues,
Atom ** values )
static

◆ getX11SelectionClipboard()

PuglX11Clipboard * getX11SelectionClipboard ( PuglView *const view,
const Atom selection )
static

◆ handleSelectionNotify()

void handleSelectionNotify ( const PuglWorld *const world,
PuglView *const view,
const XSelectionEvent *const event )
static

◆ handleSelectionRequest()

PuglStatus handleSelectionRequest ( const PuglWorld *const world,
PuglView *const view,
const XSelectionRequestEvent *const request )
static

◆ handleTimerEvent()

bool handleTimerEvent ( PuglWorld *const world,
const XEvent xevent )
static

◆ initXSync()

bool initXSync ( PuglWorldInternals *const impl)
static

◆ keySymToSpecial()

PuglKey keySymToSpecial ( const KeySym sym)
static

◆ lookupString()

int lookupString ( XIC xic,
XEvent *const xevent,
char *const str,
KeySym *const sym )
static

◆ mergeExposeEvents()

void mergeExposeEvents ( PuglExposeEvent *const dst,
const PuglExposeEvent *const src )
static

◆ pollX11Socket()

PuglStatus pollX11Socket ( PuglWorld *const world,
const double timeout )
static

◆ puglFreeViewInternals()

void puglFreeViewInternals ( PuglView *const view)

Destroy and free view internals (implemented once per platform).

◆ puglFreeWorldInternals()

void puglFreeWorldInternals ( PuglWorld *const world)

Destroy and free world internals (implemented once per platform).

◆ puglInitViewInternals()

PuglInternals * puglInitViewInternals ( PuglWorld *const world)

Allocate and initialise view internals (implemented once per platform).

◆ puglInitWorldInternals()

PuglWorldInternals * puglInitWorldInternals ( const PuglWorldType type,
const PuglWorldFlags flags )

Allocate and initialise world internals (implemented once per platform).

◆ puglX11Configure()

PuglStatus puglX11Configure ( PuglView * view)

◆ puglX11GetDisplayScaleFactor()

double puglX11GetDisplayScaleFactor ( Display *const display)
static

◆ retrieveSelection()

PuglStatus retrieveSelection ( const PuglWorld *const world,
PuglView *const view,
const Atom property,
const Atom type,
PuglBlob *const result )
static

◆ setClipboardFormats()

void setClipboardFormats ( PuglView *const view,
PuglX11Clipboard *const board,
const unsigned long numFormats,
const Atom *const formats )
static

◆ translateClientMessage()

PuglEvent translateClientMessage ( PuglView *const view,
XClientMessageEvent message )
static

◆ translateEvent()

PuglEvent translateEvent ( PuglView *const view,
XEvent xevent )
static

◆ translateKey()

void translateKey ( PuglView *const view,
XEvent *const xevent,
PuglEvent *const event )
static

◆ translateModifiers()

uint32_t translateModifiers ( const unsigned xstate)
static

◆ translatePropertyNotify()

PuglEvent translatePropertyNotify ( PuglView *const view,
XPropertyEvent message )
static

◆ updateSizeHints()

PuglStatus updateSizeHints ( const PuglView *const view)
static