XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
main.cpp File Reference
#include <stdint.h>
#include <_xeneva.h>
#include <string.h>
#include <stdlib.h>
#include <sys/_keproc.h>
#include <sys/_kefile.h>
#include <sys/_kecred.h>
#include <chitralekha.h>
#include <sys/_keipcpostbox.h>
#include <sys/mman.h>
#include <font.h>
#include <sys/iocodes.h>
#include <draw.h>
#include "surface.h"
#include "deodxr.h"
#include "dirty.h"
#include "cursor.h"
#include "backdirty.h"
#include "window.h"
#include "resize.h"
#include "clip.h"
#include "_fastcpy.h"
#include "animation.h"
#include "alpha.h"
#include "nanojpg.h"
#include <arm_neon.h>
#include <keycode.h>
#include "compose.h"
#include "unikernel.h"
#include "xr_present.h"
#include "compose3d.h"
#include "keybind.h"
#include <sys/_ketime.h>
#include <gpusrv.h>
Include dependency graph for main.cpp:

Macros

#define __DEODHAI_COMPOSE3D__   1
 
#define DEODHAI_TARGET_FPS   60
 
#define FRAME_TIME_MS   (1000 / DEODHAI_TARGET_FPS)
 
#define RESIZE_EDGE_NONE   0
 
#define RESIZE_EDGE_LEFT   (1 << 0)
 
#define RESIZE_EDGE_RIGHT   (1 << 1)
 
#define RESIZE_EDGE_TOP   (1 << 2)
 
#define RESIZE_EDGE_BOTTOM   (1 << 3)
 
#define RESIZE_BORDER_LR   8
 
#define RESIZE_BORDER_TD   4
 

Functions

uint32_t DeodhaiAllocateNewHandle ()
 DeodhaiAllocateNewHandle – get a new window handle.
 
void DeodhaiInitialiseData ()
 DeodhaiInitialiseData – initialise all data.
 
void DeodhaiAddWindow (Window *win)
 DeodhaiAddWindow – add a window to window list.
 
void DeodhaiRemoveWindow (Window *win)
 
void DeodhaiAddWindowAlwaysOnTop (Window *win)
 DeodhaiAddWindow – add a window to window list.
 
void DeodhaiRemoveWindowAlwaysOnTop (Window *win)
 
Window * DeodhaiCreateWindow (int x, int y, int w, int h, uint16_t flags, uint16_t ownerId, char *title)
 DeodhaiCreateWindow – create a new deodhai window.
 
void CursorStoreBack (ChCanvas *canv, Cursor *cur, unsigned x, unsigned y)
 
void CursorDrawBack (ChCanvas *canv, Cursor *cur, unsigned x, unsigned y)
 
void DrawWallpaper (ChCanvas *canv, const char *filename)
 DrawWallpaper for getting jpeg image as wallpaper fully jpeg encoder is needed, i use synfig studio for jpeg encoder.
 
void ChangeCursor (Cursor *newCursor)
 ChangeCursor – change current cursor to new cursor.
 
void XRComposeFrame (ChCanvas *canvas)
 
void DeodhaiWindowMakeTop (Window *win)
 DeodhaiWindowMakeTop – brings a window to front.
 
void DeodhaiWindowSetFocused (Window *win, bool notify)
 DeodhaiWindowSetFocused – cast focus to a new window.
 
void DeodhaiWindowMove (Window *win, int x, int y)
 DeodhaiWindowMove – move an window to a new location.
 
bool DeodhaiCheckWindowPointOcclusion (Window *win, int x, int y)
 DeodhaiCheckWindowPointOcclusion – checks if given x and y of point of a window is occluded by another window , from given window to front window of the list.
 
void DeodhaiWindowCheckDraggable (int x, int y, int button)
 DeodhaiWindowCheckDraggable – check for draggable windows.
 
void DeodhaiWindowCheckResizable (int x, int y, int button)
 DeodhaiWindowCheckResizable – checks and resize focused Window.
 
void DeodhaiSendMouseEvent (int handle, int ownerId, uint8_t handleType, uint8_t eventType, int x, int y, int button)
 DeodhaiSendMouseEvent – send mouse event to desired window.
 
void DeodhaiBroadcastMouse (int mouse_x, int mouse_y, int button)
 
void DeodhaiWindowHide (Window *win)
 DeodhaiWindowHide – hides a window.
 
void DeodhaiBroadcastKey (int code)
 
void DeodhaiBroadcastMessage (PostEvent *e, Window *skippablewin)
 DeodhaiBrodcastMessage – broadcast a message to every window.
 
void DeodhaiCloseWindow (Window *win)
 DeodhaiCloseWindow – closes and cleanup an opened window.
 
int main (int argc, char *argv[])
 main – main entry
 
void DeodhaiUpdateBits (bool window_update, bool skip_disable)
 
int _get_gpu_display_id ()
 
bool _is_gpu_enabled ()
 
bool _is_gpu_userspace ()
 
int _get_gpu_fd ()
 
Window * _get_always_on_top ()
 
Window * _get_root_window ()
 
Window * _get_focused_window ()
 
Cursor * _get_current_cursor ()
 
void _take_update_bits (bool *window_update_all_, bool *always_on_top_update)
 
void _set_always_on_top_update (bool update)
 

Variables

ChFont * f2
 DeodhaiXR – The Graphics compositing pipeline Supports three types of input – (1) Mouse (2) Keyboard (3) Special XR input two types of rendering : 2D Compositing for non-xr system(GPU/Software), 3D compositing for XR system (GPU)
 
ChRect rectb
 
int x_
 
int y_
 

Macro Definition Documentation

◆ __DEODHAI_COMPOSE3D__

#define __DEODHAI_COMPOSE3D__   1

BSD 2-Clause License

Copyright (c) 2022, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ DEODHAI_TARGET_FPS

#define DEODHAI_TARGET_FPS   60

◆ FRAME_TIME_MS

#define FRAME_TIME_MS   (1000 / DEODHAI_TARGET_FPS)

◆ RESIZE_BORDER_LR

#define RESIZE_BORDER_LR   8

◆ RESIZE_BORDER_TD

#define RESIZE_BORDER_TD   4

◆ RESIZE_EDGE_BOTTOM

#define RESIZE_EDGE_BOTTOM   (1 << 3)

◆ RESIZE_EDGE_LEFT

#define RESIZE_EDGE_LEFT   (1 << 0)

◆ RESIZE_EDGE_NONE

#define RESIZE_EDGE_NONE   0

◆ RESIZE_EDGE_RIGHT

#define RESIZE_EDGE_RIGHT   (1 << 1)

◆ RESIZE_EDGE_TOP

#define RESIZE_EDGE_TOP   (1 << 2)

Function Documentation

◆ _get_always_on_top()

Window * _get_always_on_top ( )

◆ _get_current_cursor()

Cursor * _get_current_cursor ( )

◆ _get_focused_window()

Window * _get_focused_window ( )

◆ _get_gpu_display_id()

int _get_gpu_display_id ( )

◆ _get_gpu_fd()

int _get_gpu_fd ( )

◆ _get_root_window()

Window * _get_root_window ( )

BSD 2-Clause License

Copyright (c) 2022-2026, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ _is_gpu_enabled()

bool _is_gpu_enabled ( )

◆ _is_gpu_userspace()

bool _is_gpu_userspace ( )

◆ _set_always_on_top_update()

void _set_always_on_top_update ( bool  update)

◆ _take_update_bits()

void _take_update_bits ( bool *  window_update_all_,
bool *  always_on_top_update 
)

◆ ChangeCursor()

void ChangeCursor ( Cursor *  newCursor)

ChangeCursor – change current cursor to new cursor.

Parameters
newCursor– desired cursor

◆ CursorDrawBack()

void CursorDrawBack ( ChCanvas *  canv,
Cursor *  cur,
unsigned  x,
unsigned  y 
)

◆ CursorStoreBack()

void CursorStoreBack ( ChCanvas *  canv,
Cursor *  cur,
unsigned  x,
unsigned  y 
)

◆ DeodhaiAddWindow()

void DeodhaiAddWindow ( Window *  win)

DeodhaiAddWindow – add a window to window list.

Parameters
win– Pointer to window

◆ DeodhaiAddWindowAlwaysOnTop()

void DeodhaiAddWindowAlwaysOnTop ( Window *  win)

DeodhaiAddWindow – add a window to window list.

Parameters
win– Pointer to window

◆ DeodhaiAllocateNewHandle()

uint32_t DeodhaiAllocateNewHandle ( )

DeodhaiAllocateNewHandle – get a new window handle.

◆ DeodhaiBroadcastKey()

void DeodhaiBroadcastKey ( int  code)

◆ DeodhaiBroadcastMessage()

void DeodhaiBroadcastMessage ( PostEvent *  e,
Window *  skippablewin 
)

DeodhaiBrodcastMessage – broadcast a message to every window.

Parameters
e– PostEvent to broadcast

◆ DeodhaiBroadcastMouse()

void DeodhaiBroadcastMouse ( int  mouse_x,
int  mouse_y,
int  button 
)

◆ DeodhaiCheckWindowPointOcclusion()

bool DeodhaiCheckWindowPointOcclusion ( Window *  win,
int  x,
int  y 
)

DeodhaiCheckWindowPointOcclusion – checks if given x and y of point of a window is occluded by another window , from given window to front window of the list.

Parameters
win– Pointer to window to use for point check
x– x coord of the point
y– y coord of the point

◆ DeodhaiCloseWindow()

void DeodhaiCloseWindow ( Window *  win)

DeodhaiCloseWindow – closes and cleanup an opened window.

Parameters
win– Pointer to window to be closed

◆ DeodhaiCreateWindow()

Window * DeodhaiCreateWindow ( int  x,
int  y,
int  w,
int  h,
uint16_t  flags,
uint16_t  ownerId,
char *  title 
)

DeodhaiCreateWindow – create a new deodhai window.

◆ DeodhaiInitialiseData()

void DeodhaiInitialiseData ( )

DeodhaiInitialiseData – initialise all data.

◆ DeodhaiRemoveWindow()

void DeodhaiRemoveWindow ( Window *  win)

◆ DeodhaiRemoveWindowAlwaysOnTop()

void DeodhaiRemoveWindowAlwaysOnTop ( Window *  win)

◆ DeodhaiSendMouseEvent()

void DeodhaiSendMouseEvent ( int  handle,
int  ownerId,
uint8_t  handleType,
uint8_t  eventType,
int  x,
int  y,
int  button 
)

DeodhaiSendMouseEvent – send mouse event to desired window.

Parameters
win– Pointer to window
eventType– either MOUSE_EVENT or MOUSE_LEAVE
x– Mouse x location
y– Mouse y location
button– Mouse button state

◆ DeodhaiUpdateBits()

void DeodhaiUpdateBits ( bool  window_update,
bool  skip_disable 
)

◆ DeodhaiWindowCheckDraggable()

void DeodhaiWindowCheckDraggable ( int  x,
int  y,
int  button 
)

DeodhaiWindowCheckDraggable – check for draggable windows.

Parameters
x– mouse x pos
y– mouse y pos
button– mouse button state

◆ DeodhaiWindowCheckResizable()

void DeodhaiWindowCheckResizable ( int  x,
int  y,
int  button 
)

DeodhaiWindowCheckResizable – checks and resize focused Window.

Parameters
x– Mouse x location
y– Mouse y location
button– Mouse button state

◆ DeodhaiWindowHide()

void DeodhaiWindowHide ( Window *  win)

DeodhaiWindowHide – hides a window.

Parameters
win– Pointer to window to hide

◆ DeodhaiWindowMakeTop()

void DeodhaiWindowMakeTop ( Window *  win)

DeodhaiWindowMakeTop – brings a window to front.

Parameters
win– window to brin front

◆ DeodhaiWindowMove()

void DeodhaiWindowMove ( Window *  win,
int  x,
int  y 
)

DeodhaiWindowMove – move an window to a new location.

Parameters
win– Pointer to window
x– new x position
y– new y position

if (x <= 0) x = 0; if (y < 0) y = 0; if (x >= canvas->screenWidth) x = canvas->screenWidth - ww; if (y >= canvas->screenHeight) y = canvas->screenHeight - wh;

◆ DeodhaiWindowSetFocused()

void DeodhaiWindowSetFocused ( Window *  win,
bool  notify 
)

DeodhaiWindowSetFocused – cast focus to a new window.

◆ DrawWallpaper()

void DrawWallpaper ( ChCanvas *  canv,
const char *  filename 
)

DrawWallpaper for getting jpeg image as wallpaper fully jpeg encoder is needed, i use synfig studio for jpeg encoder.

◆ main()

int main ( int  argc,
char *  argv[] 
)

main – main entry

intialize key data structure

register deodhai as global daemon for kernel display employee

Special codes are beyond 400, so do check

◆ XRComposeFrame()

void XRComposeFrame ( ChCanvas *  canvas)

Normal application windows

do either one – dirty area tracking or else update all

Zoomed (maximised) windows: stretched-fill upscale into the compose canvas (the back surface the GPU flush presents from), above normal windows; always-on-top and cursor still compose over them afterwards. Fullscreen dirty is published so transfer moves it.

Always on Top window , stacking order

Variable Documentation

◆ f2

ChFont* f2

DeodhaiXR – The Graphics compositing pipeline Supports three types of input – (1) Mouse (2) Keyboard (3) Special XR input two types of rendering : 2D Compositing for non-xr system(GPU/Software), 3D compositing for XR system (GPU)

◆ rectb

ChRect rectb

◆ x_

int x_

◆ y_

int y_