Files
test/intern/ghost/intern/GHOST_SystemSDL.hh
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

93 lines
2.5 KiB
C++

/* SPDX-FileCopyrightText: 2011-2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup GHOST
* Declaration of GHOST_SystemSDL class.
*/
#pragma once
#include "../GHOST_Types.h"
#include "GHOST_DisplayManagerSDL.hh"
#include "GHOST_Event.hh"
#include "GHOST_System.hh"
#include "GHOST_TimerManager.hh"
#include "GHOST_WindowSDL.hh"
extern "C" {
#include "SDL.h"
}
#if !SDL_VERSION_ATLEAST(2, 0, 0)
# error "SDL 2.0 or newer is needed to build with Ghost"
#endif
class GHOST_WindowSDL;
class GHOST_SystemSDL : public GHOST_System {
public:
void addDirtyWindow(GHOST_WindowSDL *bad_wind);
GHOST_SystemSDL();
~GHOST_SystemSDL();
bool processEvents(bool waitForEvent) override;
bool setConsoleWindowState(GHOST_TConsoleWindowState /*action*/) override
{
return false;
}
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override;
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override;
GHOST_TCapabilityFlag getCapabilities() const override;
char *getClipboard(bool selection) const override;
void putClipboard(const char *buffer, bool selection) const override;
uint64_t getMilliSeconds() const override;
uint8_t getNumDisplays() const override;
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override;
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override;
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override;
GHOST_IContext *createOffscreenContext(GHOST_GPUSettings gpuSettings) override;
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;
private:
GHOST_TSuccess init() override;
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TWindowState state,
GHOST_GPUSettings gpuSettings,
const bool exclusive = false,
const bool is_dialog = false,
const GHOST_IWindow *parentWindow = nullptr) override;
/* SDL specific */
GHOST_WindowSDL *findGhostWindow(SDL_Window *sdl_win);
bool generateWindowExposeEvents();
void processEvent(SDL_Event *sdl_event);
/** The vector of windows that need to be updated. */
std::vector<GHOST_WindowSDL *> m_dirty_windows;
};