Window manager related SDL 2 services

Introduced classes

extern class SDLSysWMInfo

sdl2 :: SDLSysWMInfo

Information on the window manager

Redefined classes

redef extern class SDLWindow

sdl2 :: syswm $ SDLWindow

A window created by SDL

All class definitions

extern class SDLSysWMInfo

sdl2 $ SDLSysWMInfo

Information on the window manager
redef extern class SDLWindow

sdl2 :: syswm $ SDLWindow

A window created by SDL
package_diagram sdl2::syswm syswm sdl2::sdl2_base sdl2_base sdl2::syswm->sdl2::sdl2_base core core sdl2::sdl2_base->core ...core ... ...core->core sdl2::sdl2 sdl2 sdl2::sdl2->sdl2::syswm sdl2::image image sdl2::image->sdl2::sdl2 glesv2::opengles2_hello_triangle opengles2_hello_triangle glesv2::opengles2_hello_triangle->sdl2::sdl2 sdl2::image... ... sdl2::image...->sdl2::image glesv2::opengles2_hello_triangle... ... glesv2::opengles2_hello_triangle...->glesv2::opengles2_hello_triangle

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module environ

core :: environ

Access to the environment variables of the process
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module math

core :: math

Mathematical operations
module native

core :: native

Native structures for text and bytes
module numeric

core :: numeric

Advanced services for Numeric types
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O

Parents

module sdl2_base

sdl2 :: sdl2_base

Basic SDL 2 features

Children

module sdl2

sdl2 :: sdl2

Simple DirectMedia Layer (SDL) 2.0 services for easy window creation and 2D drawing

Descendants

module a_star-m

a_star-m

module all

sdl2 :: all

Unites the main sdl2 module and its sister library sdl2::image
module camera_control_linux

gamnit :: camera_control_linux

Mouse wheel and middle mouse button to control camera
module display_linux

gamnit :: display_linux

Gamnit display implementation for GNU/Linux using egl, sdl and x11
module gamnit_linux

gamnit :: gamnit_linux

Support services for Gamnit on GNU/Linux
module image

sdl2 :: image

Services of the SDL_image 2.0 library
module minimal

sdl2 :: minimal

An example to test and demonstrate the sdl2 lib with image and events
module opengles2_hello_triangle

glesv2 :: opengles2_hello_triangle

Basic example of OpenGL ES 2.0 usage using SDL 2
# Window manager related SDL 2 services
module syswm is pkgconfig "sdl2"

import sdl2_base

in "C Header" `{
	#include <SDL2/SDL_syswm.h>
`}

redef extern class SDLWindow
	# Get the `SDLSysVMInfo` for the system running this window
	#
	# The returned value must be freed.
	fun wm_info: SDLSysWMInfo `{
		SDL_SysWMinfo *val = malloc(sizeof(SDL_SysWMinfo));

		SDL_VERSION(&val->version);

		if(SDL_GetWindowWMInfo(self, val) <= 0) {
			free(val);
			return NULL;
		}

		return val;
	`}
end

# Information on the window manager
#
# Created using `SDLWindow::vm_info`
extern class SDLSysWMInfo `{ SDL_SysWMinfo * `}
	# Is this an unknown window manager?
	fun is_unknown: Bool `{ return self->subsystem == SDL_SYSWM_UNKNOWN; `}

	# Is this a Windows system?
	fun is_windows: Bool `{ return self->subsystem == SDL_SYSWM_WINDOWS; `}

	# Is this the X11 window manager?
	fun is_x11: Bool `{ return self->subsystem == SDL_SYSWM_X11; `}

	# Is this a direct DirectFB?
	fun is_direcfb: Bool `{ return self->subsystem == SDL_SYSWM_DIRECTFB; `}

	# Is this system an OS X?
	fun is_cocoa: Bool `{ return self->subsystem == SDL_SYSWM_COCOA; `}

	# Is this system an iOS?
	fun is_uikit: Bool `{ return self->subsystem == SDL_SYSWM_UIKIT; `}

	# It this window manager Wayland?
	fun is_wayland: Bool `{
		#if SDL_VERSION_ATLEAST(2, 0, 2)
			return self->subsystem == SDL_SYSWM_WAYLAND;
		#else
			return 0;
		#endif
	`}

	# It this window manager Mir?
	fun is_mir: Bool `{
		#if SDL_VERSION_ATLEAST(2, 0, 3)
			return self->subsystem == SDL_SYSWM_MIR;
		#else
			return 0;
		#endif
	`}

	# Is this system a Windows RT?
	fun is_winrt: Bool `{
		#if SDL_VERSION_ATLEAST(2, 0, 3)
			return self->subsystem == SDL_SYSWM_WINRT;
		#else
			return 0;
		#endif
	`}

	# Is this system an Android?
	fun is_android: Bool `{
		#if SDL_VERSION_ATLEAST(2, 0, 4)
			return self->subsystem == SDL_SYSWM_ANDROID;
		#else
			return 0;
		#endif
	`}

	# Handle to the window
	fun window_handle: Pointer `{
		#ifdef _WIN32
			return (void*)self->info.win.window;
		#else
			return (void*)self->info.x11.window;
		#endif
	`}

	# Handle to the display or device context
	fun display_handle: Pointer `{
		#ifdef _WIN32
			return (void*)self->info.win.hdc;
		#else
			return (void*)self->info.x11.display;
		#endif
	`}
end
lib/sdl2/syswm.nit:17,1--119,3