PatchworkOS
Loading...
Searching...
No Matches
window.c File Reference
#include <libpatchwork/display.h>
#include <libpatchwork/image.h>
#include "internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  deco_private_t
 

Macros

#define __STDC_WANT_LIB_EXT1__   1
 
#define WINDOW_CLIENT_ELEM_ID   (UINT64_MAX)
 
#define WINDOW_DECO_ELEM_ID   (UINT64_MAX - 1)
 
#define WINDOW_DECO_CLOSE_BUTTON_ID   (UINT64_MAX - 2)
 
#define WINDOW_DECO_MINIMIZE_BUTTON_ID   (UINT64_MAX - 3)
 
#define WINDOW_DECO_CLOSE_BUTTON_INDEX   0
 
#define WINDOW_DECO_MINIMIZE_BUTTON_INDEX   1
 
#define WINDOW_DECO_BUTTON_AMOUNT   2
 

Functions

static void window_deco_titlebar_rect (window_t *win, element_t *elem, rect_t *rect)
 
static void window_deco_button_rect (window_t *win, element_t *elem, rect_t *rect, uint64_t index)
 
static void window_deco_draw_titlebar (window_t *win, element_t *elem, drawable_t *draw)
 
static void window_deco_handle_dragging (window_t *win, element_t *elem, const event_mouse_t *event)
 
static uint64_t window_deco_init_controls (window_t *win, element_t *elem, deco_private_t *private)
 
static uint64_t window_deco_init (window_t *win, element_t *elem)
 
static void window_deco_free (element_t *elem)
 
static void window_deco_redraw (window_t *win, element_t *elem)
 
static void window_deco_action (window_t *win, const levent_action_t *action)
 
static void window_deco_report (window_t *win, element_t *elem, const event_report_t *report)
 
static uint64_t window_deco_procedure (window_t *win, element_t *elem, const event_t *event)
 
window_twindow_new (display_t *disp, const char *name, const rect_t *rect, surface_type_t type, window_flags_t flags, procedure_t procedure, void *private)
 Allocate and initialize a new window.
 
void window_free (window_t *win)
 Free a window.
 
rect_t window_get_rect (window_t *win)
 Get the window's rectangle in screen coordinates.
 
rect_t window_get_local_rect (window_t *win)
 
display_twindow_get_display (window_t *win)
 Get the display associated with the window.
 
surface_id_t window_get_id (window_t *win)
 Get the surface ID of the window.
 
surface_type_t window_get_type (window_t *win)
 Get the surface type of the window.
 
element_twindow_get_client_element (window_t *win)
 Get the client element of the window.
 
uint64_t window_move (window_t *win, const rect_t *rect)
 Move and/or resize the window.
 
uint64_t window_set_timer (window_t *win, timer_flags_t flags, clock_t timeout)
 Set the window timer.
 
void window_invalidate (window_t *win, const rect_t *rect)
 Invalidate a rectangle of the window.
 
uint64_t window_invalidate_flush (window_t *win)
 Flush invalidated rectangles to the DWM.
 
uint64_t window_dispatch (window_t *win, const event_t *event)
 Dispatch an event to the window's elements.
 
uint64_t window_set_focus (window_t *win)
 Set the focus to the window.
 
uint64_t window_set_visible (window_t *win, bool isVisible)
 Set the visibility of the window.
 

Macro Definition Documentation

◆ __STDC_WANT_LIB_EXT1__

#define __STDC_WANT_LIB_EXT1__   1

Definition at line 3 of file window.c.

◆ WINDOW_CLIENT_ELEM_ID

#define WINDOW_CLIENT_ELEM_ID   (UINT64_MAX)

Definition at line 10 of file window.c.

◆ WINDOW_DECO_BUTTON_AMOUNT

#define WINDOW_DECO_BUTTON_AMOUNT   2

Definition at line 17 of file window.c.

◆ WINDOW_DECO_CLOSE_BUTTON_ID

#define WINDOW_DECO_CLOSE_BUTTON_ID   (UINT64_MAX - 2)

Definition at line 12 of file window.c.

◆ WINDOW_DECO_CLOSE_BUTTON_INDEX

#define WINDOW_DECO_CLOSE_BUTTON_INDEX   0

Definition at line 15 of file window.c.

◆ WINDOW_DECO_ELEM_ID

#define WINDOW_DECO_ELEM_ID   (UINT64_MAX - 1)

Definition at line 11 of file window.c.

◆ WINDOW_DECO_MINIMIZE_BUTTON_ID

#define WINDOW_DECO_MINIMIZE_BUTTON_ID   (UINT64_MAX - 3)

Definition at line 13 of file window.c.

◆ WINDOW_DECO_MINIMIZE_BUTTON_INDEX

#define WINDOW_DECO_MINIMIZE_BUTTON_INDEX   1

Definition at line 16 of file window.c.

Function Documentation

◆ window_deco_action()

◆ window_deco_button_rect()

static void window_deco_button_rect ( window_t win,
element_t elem,
rect_t rect,
uint64_t  index 
)
static

◆ window_deco_draw_titlebar()

◆ window_deco_free()

static void window_deco_free ( element_t elem)
static

Definition at line 198 of file window.c.

References element_get_private(), free(), image_free(), and NULL.

Referenced by window_deco_procedure().

◆ window_deco_handle_dragging()

◆ window_deco_init()

static uint64_t window_deco_init ( window_t win,
element_t elem 
)
static

◆ window_deco_init_controls()

◆ window_deco_procedure()

◆ window_deco_redraw()

◆ window_deco_report()

◆ window_deco_titlebar_rect()

static void window_deco_titlebar_rect ( window_t win,
element_t elem,
rect_t rect 
)
static

◆ window_get_local_rect()

rect_t window_get_local_rect ( window_t win)

Definition at line 457 of file window.c.

References NULL, window_t::rect, RECT_HEIGHT, RECT_INIT_DIM, and RECT_WIDTH.