Skip to content

Commit

Permalink
Remove lv_windows_interop.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jan 12, 2024
1 parent 179451e commit 9750e71
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 195 deletions.
1 change: 0 additions & 1 deletion LvglWindowsSimulator/LvglWindowsSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "lvgl/demos/lv_demos.h"

#include "lv_windows_context.h"
#include "lv_windows_interop.h"
#include "lv_windows_input.h"
#include "lv_windows_display.h"

Expand Down
2 changes: 0 additions & 2 deletions LvglWindowsSimulator/LvglWindowsSimulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@
<ClInclude Include="lv_windows_context.h" />
<ClInclude Include="lv_windows_display.h" />
<ClInclude Include="lv_windows_input.h" />
<ClInclude Include="lv_windows_interop.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="LvglWindowsSimulator.manifest" />
Expand Down Expand Up @@ -963,7 +962,6 @@
<ClCompile Include="LvglWindowsSimulator.cpp" />
<ClCompile Include="lv_windows_context.c" />
<ClCompile Include="lv_windows_display.c" />
<ClCompile Include="lv_windows_interop.c" />
<ClCompile Include="lv_windows_input.c" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions LvglWindowsSimulator/LvglWindowsSimulator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,6 @@
</ClInclude>
<ClInclude Include="lv_conf.h" />
<ClInclude Include="lv_windows_context.h" />
<ClInclude Include="lv_windows_interop.h" />
<ClInclude Include="lv_windows_input.h" />
<ClInclude Include="lv_windows_display.h" />
</ItemGroup>
Expand Down Expand Up @@ -2746,7 +2745,6 @@
</ClCompile>
<ClCompile Include="LvglWindowsSimulator.cpp" />
<ClCompile Include="lv_windows_context.c" />
<ClCompile Include="lv_windows_interop.c" />
<ClCompile Include="lv_windows_input.c" />
<ClCompile Include="lv_windows_display.c" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion LvglWindowsSimulator/lv_windows_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "lv_windows_context.h"
#ifdef LV_USE_WINDOWS

#include "lv_windows_interop.h"
#include "lv_windows_display.h"

/*********************
* DEFINES
Expand Down
25 changes: 25 additions & 0 deletions LvglWindowsSimulator/lv_windows_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,31 @@ lv_display_t* lv_windows_create_display(
return display;
}

HWND lv_windows_get_display_window_handle(lv_display_t* display)
{
return (HWND)lv_display_get_driver_data(display);
}

int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level)
{
return MulDiv(physical, LV_WINDOWS_ZOOM_BASE_LEVEL, zoom_level);
}

int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level)
{
return MulDiv(logical, zoom_level, LV_WINDOWS_ZOOM_BASE_LEVEL);
}

int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi)
{
return MulDiv(physical, USER_DEFAULT_SCREEN_DPI, dpi);
}

int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi)
{
return MulDiv(logical, dpi, USER_DEFAULT_SCREEN_DPI);
}

/**********************
* STATIC FUNCTIONS
**********************/
Expand Down
63 changes: 63 additions & 0 deletions LvglWindowsSimulator/lv_windows_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ extern "C" {

#ifdef LV_USE_WINDOWS

#include <windows.h>

/*********************
* DEFINES
*********************/

#define LV_WINDOWS_ZOOM_BASE_LEVEL 100

#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif

/**********************
* TYPEDEFS
**********************/
Expand All @@ -42,6 +50,61 @@ extern "C" {
bool allow_dpi_override,
bool simulator_mode);

/**
* @brief Get the window handle from specific LVGL display object.
* @param display The specific LVGL display object.
* @return The window handle from specific LVGL display object.
*/
HWND lv_windows_get_display_window_handle(lv_display_t* display);

/**
* @brief Get logical pixel value from physical pixel value taken account
* with zoom level.
* @param physical The physical pixel value taken account with zoom level.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level);

/**
* @brief Get physical pixel value taken account with zoom level from
* logical pixel value.
* @param logical The logical pixel value.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The physical pixel value taken account with zoom level.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level);

/**
* @brief Get logical pixel value from physical pixel value taken account
* with DPI scaling.
* @param physical The physical pixel value taken account with DPI scaling.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi);

/**
* @brief Get physical pixel value taken account with DPI scaling from
* logical pixel value.
* @param logical The logical pixel value.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The physical pixel value taken account with DPI scaling.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi);

/**********************
* MACROS
**********************/
Expand Down
7 changes: 6 additions & 1 deletion LvglWindowsSimulator/lv_windows_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifdef LV_USE_WINDOWS

#include "lv_windows_context.h"
#include "lv_windows_interop.h"
#include "lv_windows_display.h"

#include <windowsx.h>

Expand Down Expand Up @@ -61,6 +61,11 @@ static void lv_windows_release_encoder_device_event_callback(lv_event_t* e);
* GLOBAL FUNCTIONS
**********************/

HWND lv_windows_get_indev_window_handle(lv_indev_t* indev)
{
return lv_windows_get_display_window_handle(lv_indev_get_display(indev));
}

lv_indev_t* lv_windows_acquire_pointer_device(lv_display_t* display)
{
HWND window_handle = lv_windows_get_display_window_handle(display);
Expand Down
9 changes: 9 additions & 0 deletions LvglWindowsSimulator/lv_windows_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ extern "C" {

#ifdef LV_USE_WINDOWS

#include <windows.h>

/*********************
* DEFINES
*********************/
Expand All @@ -34,6 +36,13 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/

/**
* @brief Get the window handle from specific LVGL input device object.
* @param indev The specific LVGL input device object.
* @return The window handle from specific LVGL input device object.
*/
HWND lv_windows_get_indev_window_handle(lv_indev_t* indev);

/**
* @brief Open a LVGL pointer input device object for the specific LVGL
* display object, or create it if the LVGL pointer input device
Expand Down
71 changes: 0 additions & 71 deletions LvglWindowsSimulator/lv_windows_interop.c

This file was deleted.

117 changes: 0 additions & 117 deletions LvglWindowsSimulator/lv_windows_interop.h

This file was deleted.

0 comments on commit 9750e71

Please sign in to comment.