libxputty 0.1
Loading...
Searching...
No Matches
Functions | Variables
xwidget-mswin.c File Reference

Go to the source code of this file.

Functions

void SetClientSize (HWND hwnd, int clientWidth, int clientHeight)
 
BOOL SetMouseTracking (HWND hwnd, BOOL enable)
 
LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LRESULT onPaint (HWND hwnd, WPARAM wParam, LPARAM lParam)
 
void debug_lasterror (const char *prefix, const char *prefix2)
 
char * convert_cp (DWORD cp_from, DWORD cp_to, char *s_from)
 
char * utf8_from_locale (char *localestr)
 utf8_from_locale - convert active codepage to utf8 must be freed by the caller
 
char * locale_from_utf8 (char *utf8str)
 locale_from_utf8 - convert utf8 to active codepage must be freed by the caller
 
Displayos_open_display (char *display_name)
 os_open_display - Connect to the display to use
 
void os_close_display (Display *dpy)
 os_close_display - Close connection to the used display
 
void os_destroy_window (Widget_t *w)
 os_destroy_window - destroy a widget (close and remove from processing)
 
Window os_get_root_window (Xputty *main, int flag)
 os_get_root_window - get a pointer to the root window (desktop)
 
void os_translate_coords (Widget_t *w, Window from_window, Window to_window, int from_x, int from_y, int *to_x, int *to_y)
 os_translate_coords - get x,y related to destination Window
 
void os_get_window_metrics (Widget_t *w_, Metrics_t *metrics)
 os_get_window_metrics - Get the Merics_t struct related to a Widget_t
 
void os_set_window_min_size (Widget_t *w, int min_width, int min_height, int base_width, int base_height)
 os_set_window_min_size - Set the min and base size of a Widget_t
 
void os_move_window (Display *dpy, Widget_t *w, int x, int y)
 os_move_window - Move a Widget_t
 
void os_resize_window (Display *dpy, Widget_t *w, int x, int y)
 os_resize_window - Resize a Widget_t
 
void os_get_surface_size (cairo_surface_t *surface, int *width, int *height)
 os_get_surface_size - get the size of the cairo surface
 
void os_set_widget_surface_size (Widget_t *w, int width, int height)
 os_set_widget_surface_size - set the size of a Widget_t cairo surface
 
void os_create_main_window_and_surface (Widget_t *w, Xputty *app, Window win, int x, int y, int width, int height)
 os_create_main_window_and_surface - create a Widget_t with a acairo surface this function is used mainly internal on create_window()
 
void os_create_widget_window_and_surface (Widget_t *w, Xputty *app, Widget_t *parent, int x, int y, int width, int height)
 os_create_main_widget_and_surface - create a Widget_t with a acairo surface this function is used mainly internal on create_widget()
 
void os_set_title (Widget_t *w, const char *title)
 os_set_title - Set the title of a Widget_t
 
void os_widget_show (Widget_t *w)
 os_widget_show - Show a Widget_t
 
void os_widget_hide (Widget_t *w)
 os_widget_hide - Hide a Widget_t
 
void os_show_tooltip (Widget_t *wid, Widget_t *w)
 os_show_tooltip - Show a tooltip of a Widget_t
 
void os_expose_widget (Widget_t *w)
 os_expose_widget - Draw the the back buffer to the Widget_t surface
 
void os_widget_event_loop (void *w_, void *event, Xputty *main, void *user_data)
 os_widget_event_loop - the Widget_t event loop on windows all messges goes into WndProc, so stub here
 
void os_send_configure_event (Widget_t *w, int x, int y, int width, int height)
 os_send_configure_event - Send a configure event to a Widget_t
 
void os_send_button_press_event (Widget_t *w)
 os_send_button_press_event - Send a button press event to a Widget_t see XButtonEvent
 
void os_send_button_release_event (Widget_t *w)
 os_send_button_release_event - Send a button release event to a Widget_t see XButtonEvent
 
void os_send_systray_message (Widget_t *w)
 os_send_send_systray_message - Send a systray event to a Widget_t only working on Linux for now
 
int os_grab_pointer (Widget_t *w)
 os_grab_pointer - grab the mouse pointer. Works only on linux
 
void os_set_input_mask (Widget_t *w)
 os_set_input_mask - set the Event mask to a Widget_t only work on linux, stub on Windows
 
void os_set_window_attrb (Widget_t *w)
 os_set_window_attrb - set the attribute mask to a Widget_t only work on linux, stub on Windows
 
void os_set_transient_for_hint (Widget_t *parent, Widget_t *w)
 os_set_ transient_for_hint - set a Widget_t transient to a other Widget_t only work on linux, stub on Windows
 
int os_get_screen_height (Widget_t *w)
 os_get_screen_height - Get the height of the used Display
 
int os_get_screen_width (Widget_t *w)
 os_get_screen_width - Get the width of the used Display
 
char * os_get_home_dir ()
 os_get_home_dir - get the users home directory
 
bool os_is_directory (const char *filename)
 os_is directory - check if a given path is a directory or a file
 
void os_transparent_draw (void *w_, void *user_data)
 os_transparent_draw - Draw the Widget_t to the back buffer
 
void os_adjustment_callback (void *w_, void *user_data)
 os_adjustment_callback - called when a adjustment value have changed used internal for redraw the Widget_t
 
bool os_get_keyboard_input (Widget_t *w, XKeyEvent *key, char *buf, size_t bufsize)
 os_ get_keyboard_input - Get the Keyboard input and convert it to utf8
 
void os_free_pixmap (Widget_t *w, Pixmap pixmap)
 os_free_pixmap - Free the memory used by a Pixmap only Linux, stub otherwise
 
void os_quit (Widget_t *w)
 os_quit - quit the main loop and free all used memory
 
void os_quit_widget (Widget_t *w)
 os_quit_widget - remove a Widget_t from the main loop and free it's used memory
 
Atom os_register_wm_delete_window (Widget_t *wid)
 os_register_wm_delete_window - Get the needed Atom to send a widget delete message
 
Atom os_register_widget_destroy (Widget_t *wid)
 os_register_widget_destroy - Get the needed Atom to send a widget destroy message
 
void os_main_run (Xputty *main)
 os_main_run - start the event loop
 
void os_run_embedded (Xputty *main)
 os_run_embedded - the event handling when run embedded on windows all messges goes into WndProc, so stub here
 
void os_init_dnd (Xputty *main)
 os_init_dnd - register a Widget_t for handling drag and drop events only implemented on linux
 
void build_xkey_event (XKeyEvent *ev, UINT msg, WPARAM wParam, LPARAM lParam)
 
void HandleFiles (WPARAM wParam, Widget_t *wid)
 

Variables

TCHAR szMainUIClassName [] = TEXT("xputtyMainUI____0123456789ABCDEF")
 
TCHAR szWidgetUIClassName [] = TEXT("xputtyWidgetUI__0123456789ABCDEF")
 

Function Documentation

◆ build_xkey_event()

void build_xkey_event ( XKeyEvent ev,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 487 of file xwidget-mswin.c.

487 {
488 UINT uVirtKey = (UINT)wParam;
489 UINT uScanCode = (UINT)(HIWORD(lParam) & 0x1FF);
490 BYTE lpKeyState[256];
491 if (GetKeyboardState(lpKeyState)) {
492 //https://stackoverflow.com/questions/42667205/maximum-number-of-characters-output-from-win32-tounicode-toascii
493 // required size for the return buffer isn't exactly clear, maybe 255, so 1K should be a safe guess
494 WCHAR lpChar[1024];
495 UINT uFlags = 0x04; // 1=menu is active, 4=dont change anything
496 if (msg == WM_CHAR) {
497 ev->vk = uVirtKey;
498 ev->vk_is_final_char = 1;
499 } else {
500 ToUnicode(uVirtKey, uScanCode, lpKeyState, lpChar, 2, uFlags);
501 ev->vk = lpChar[0];
502 ev->vk_is_final_char = 0;
503 }
504 }
505 // handle special characters (only in KEYUP/DOWN?)
506 switch (uScanCode) {
507 case 0x0029: ev->keycode = XK_dead_circumflex; break;
508 case 0x000e: ev->keycode = XK_BackSpace; break;
509 case 0x000f: ev->keycode = XK_Tab; break;
510 case 0x001c: ev->keycode = XK_Return; break;
511 case 0x0147: ev->keycode = XK_Home; break;
512 case 0x014b: ev->keycode = XK_Left; break;
513 case 0x0148: ev->keycode = XK_Up; break;
514 case 0x014d: ev->keycode = XK_Right; break;
515 case 0x0150: ev->keycode = XK_Down; break;
516 case 0x014f: ev->keycode = XK_End; break;
517 case 0x0152: ev->keycode = XK_Insert; break;
518 case 0x011c: ev->keycode = XK_KP_Enter; break;
519 case 0x0047: ev->keycode = XK_KP_Home; break;
520 case 0x004b: ev->keycode = XK_KP_Left; break;
521 case 0x0048: ev->keycode = XK_KP_Up; break;
522 case 0x004d: ev->keycode = XK_KP_Right; break;
523 case 0x0050: ev->keycode = XK_KP_Down; break;
524 case 0x004f: ev->keycode = XK_KP_End; break;
525 case 0x0052: ev->keycode = XK_KP_Insert; break;
526 case 0x004e: ev->keycode = XK_KP_Add; break;
527 case 0x004a: ev->keycode = XK_KP_Subtract; break;
528 default:
529 if (ev->vk == 0xfc) //'ü'
530 ev->keycode = XK_udiaeresis;
531 else if (ev->vk == 0xdc) //'Ü'
532 ev->keycode = XK_dead_diaeresis;
533 else
534 ev->keycode = ev->vk;
535 }
536}
bool vk_is_final_char
int keycode
WORD vk

References XEvent::keycode, XEvent::vk, and XEvent::vk_is_final_char.

Referenced by WndProc().

◆ convert_cp()

char * convert_cp ( DWORD  cp_from,
DWORD  cp_to,
char *  s_from 
)

Definition at line 71 of file xwidget-mswin.c.

71 {
72 char *s_to = NULL;
73 int flags = MB_PRECOMPOSED; // | MB_ERR_INVALID_CHARS;
74 // prepare conversion to WideChar (using cp_from) - get required space
75 size_t size = MultiByteToWideChar(cp_from, flags, s_from, -1, NULL, 0);
76 if (size) {
77 // convert Ansi to WideChar (pwc)
78 wchar_t *pwc= (wchar_t*)malloc(size*2);
79 size_t size_wc = MultiByteToWideChar(cp_from, flags, s_from, -1, pwc, size);
80 if (size_wc) {
81 // prepare conversion to cp_to - get required space
82 flags = 0;
83 size = WideCharToMultiByte(cp_to, flags, pwc, size_wc, NULL, 0, NULL, NULL);
84 if (size) {
85 // convert WideChar (pwc) to Ansi using cp_to
86 s_to = (char*)malloc(size+1);
87 memset(s_to, 0 , size+1);
88 size = WideCharToMultiByte(cp_to, flags, pwc, size_wc, s_to, size, NULL, NULL);
89 }
90 }
91 free(pwc);
92 }
93 // needs to be free()d by caller
94 return s_to;
95}

Referenced by locale_from_utf8(), and utf8_from_locale().

◆ debug_lasterror()

void debug_lasterror ( const char *  prefix,
const char *  prefix2 
)

Definition at line 49 of file xwidget-mswin.c.

49 {
50 LPSTR msg = NULL;
51 DWORD err = GetLastError();
52 size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
53 |FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
54 NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
55 (LPSTR)&msg, 0, NULL);
56 if (size) {
57 debug_print("%s%s:ERR=%8.8lx (%ld): %s\n",prefix?prefix:"",prefix2?prefix2:"",err,err,msg);
58 LocalFree(msg);
59 } else {
60 DWORD fmt_err = GetLastError();
61 debug_print("%s%s:ERROR:FormatMessage for ERR=%8.8lx (%ld) returned %8.8lx (%ld)\n",
62 (prefix ? prefix : ""), (prefix2 ? prefix2 : ""), err, err, fmt_err, fmt_err);
63 }
64}

Referenced by os_quit().

◆ HandleFiles()

void HandleFiles ( WPARAM  wParam,
Widget_t wid 
)

Definition at line 538 of file xwidget-mswin.c.

539{
540 // DragQueryFile() takes a LPWSTR for the name so we need a TCHAR string
541 TCHAR szName[MAX_PATH];
542
543 // Here we cast the wParam as a HDROP handle to pass into the next functions
544 HDROP hDrop = (HDROP)wParam;
545
546 int count = DragQueryFile(hDrop, 0xFFFFFFFF, szName, MAX_PATH);
547
548 // Here we go through all the files that were drag and dropped then display them
549 for(int i = 0; i < count; i++) {
550 DragQueryFile(hDrop, i, szName, MAX_PATH);
551
552 // Bring up a message box that displays the current file being processed
553 // MessageBox(GetForegroundWindow(), szName, "Current file received", MB_OK);
554 char *dndfile = utf8_from_locale(szName);
555 wid->func.dnd_notify_callback(wid, (void*)&dndfile);
556 free(dndfile);
557 }
558
559 DragFinish(hDrop);
560}
xevfunc dnd_notify_callback
Definition xwidget.h:97
Func_t func
Definition xwidget.h:481
char * utf8_from_locale(char *localestr)
utf8_from_locale - convert active codepage to utf8 must be freed by the caller

References Func_t::dnd_notify_callback, Widget_t::func, and utf8_from_locale().

Referenced by WndProc().

◆ locale_from_utf8()

char * locale_from_utf8 ( char *  utf8str)

locale_from_utf8 - convert utf8 to active codepage must be freed by the caller

Parameters
*utf8str- Pointer to char to convert
Returns
*char - the converted char in locale format

Definition at line 109 of file xwidget-mswin.c.

109 {
110 return (convert_cp(CP_UTF8, GetACP(), utf8str));
111}
char * convert_cp(DWORD cp_from, DWORD cp_to, char *s_from)

References asprintf(), and convert_cp().

◆ onPaint()

LRESULT onPaint ( HWND  hwnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 961 of file xwidget-mswin.c.

961 {
962 PAINTSTRUCT ps ;
963 Widget_t *w = (Widget_t *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
964
965 // The cairo_win32_surface should only exist between BeginPaint()/EndPaint(),
966 // otherwise it becomes unusable once the HDC of the owner window changes
967 // (what can happen anytime, e.g. on resize).
968 // Therefore, w->surface is created as a simple cairo_image_surface,
969 // that can exist throughout the plugins lifetime (exception: see resize_event())
970 // and is copied to a win32_surface in the onPaint() event (see WM_PAINT).
971
972 // draw onto the image surface first
973 transparent_draw(w, NULL);
974
975 // prepare to update window
976 HDC hdc = BeginPaint(hwnd, &ps );
977
978 // create the cairo surface and context
979 cairo_surface_t *surface = cairo_win32_surface_create (hdc);
980 cairo_t *cr = cairo_create (surface);
981 // copy contents of the (permanent) image_surface to the win32_surface
982 cairo_set_source_surface(cr, w->surface, 0.0, 0.0);
983 cairo_paint(cr);
984
985 // cleanup
986 cairo_destroy (cr);
987 cairo_surface_destroy (surface);
988
989 EndPaint( hwnd, &ps );
990 return 0 ;
991}
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
cairo_surface_t * surface
Definition xwidget.h:483
void transparent_draw(void *wid, void *user_data)
transparent_draw - copy parent surface to child surface you usaualy didn't need to call this,...
Definition xwidget.c:449

References Widget_t::surface, and transparent_draw().

Referenced by WndProc().

◆ os_adjustment_callback()

void os_adjustment_callback ( void *  w_,
void *  user_data 
)

os_adjustment_callback - called when a adjustment value have changed used internal for redraw the Widget_t

Parameters
*w_- Pointer to the widget
*user_data- additional user data or NULL

Definition at line 398 of file xwidget-mswin.c.

398 {
399 Widget_t *w = (Widget_t *)w_;
400 // transparent_draw(w, user_data);
401 RedrawWindow(w->widget, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
402}
Window widget
Definition xwidget.h:469

References transparent_draw(), and Widget_t::widget.

Referenced by create_widget(), and create_window().

◆ os_close_display()

void os_close_display ( Display dpy)

os_close_display - Close connection to the used display

Parameters
*dpy- Display to close

Definition at line 118 of file xwidget-mswin.c.

118 {
119 // nothing to do on MSWin
120}

Referenced by main_quit().

◆ os_create_main_window_and_surface()

void os_create_main_window_and_surface ( Widget_t w,
Xputty app,
Window  win,
int  x,
int  y,
int  width,
int  height 
)

os_create_main_window_and_surface - create a Widget_t with a acairo surface this function is used mainly internal on create_window()

Parameters
*w- the Widget_t to create
*app- the Xputty struct the Widget_t belongs to
*win- the Parent Window were the Widget_t belongs to
x,y- the position related to the Parent Window
*width,*height- the Widget_t size

Definition at line 195 of file xwidget-mswin.c.

196 {
197 // Event callbacks already start during CreateWindow(),
198 // so prepare childlist before that call on MSWin
199 // (on Linux, adding to childlist starts message events)
201 // prepare window class
202 WNDCLASS wndclass = {0};
203 HINSTANCE hInstance = NULL;
204
205 snprintf(szMainUIClassName+16, 16, "%p", WndProc);
206 snprintf(szWidgetUIClassName+16, 16, "%p", WndProc);
207
208 // create a permanent surface for drawing (see onPaint() event)
209 w->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
210
211 wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
212 wndclass.lpfnWndProc = WndProc;
213 wndclass.hInstance = hInstance;
214 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
215 wndclass.hbrBackground = NULL;
216 wndclass.lpszClassName = szMainUIClassName;
217 wndclass.cbWndExtra = sizeof(w); // reserve space for SetWindowLongPtr
218 RegisterClass(&wndclass);
219 // TODO: pass window style (mainwindow,childwidget,popup,...) to create_window()
220 // _WIN32 doesnt allow changing the style afterwards, as it is done in xmenu.cpp
221 // (this also removes duplicate code for window/widget creation).
222 // For the current situation it is sufficient to set popup style if parent is HWND_DESKTOP.
223 DWORD dwStyle = 0;
224 DWORD dwExStyle = 0;
225 // dwExStyle:
226 // WS_EX_APPWINDOW - force(!) taskbar icon
227 // WS_EX_CONTROLPARENT - contains children, uses tab+cursor nav.
228 // WS_EX_NOPARENTNOTIFY - no PARENTNOTIFY on create/destroy
229 // WS_EX_TOOLWINDOW - no taskbar icon
230 // WS_EX_TOPMOST - above all others
231 if (win == (HWND)-1) {
232 // Dialogs with border
233 dwStyle = WS_OVERLAPPEDWINDOW;
234 dwExStyle = WS_EX_CONTROLPARENT | WS_EX_ACCEPTFILES;
235 win = HWND_DESKTOP;
236 // include border widths
237 RECT Rect = {0};
238 BOOL bMenu = false;
239 Rect.right = width;
240 Rect.bottom = height;
241 if (AdjustWindowRectEx(&Rect, dwStyle, bMenu, dwExStyle)) {
242 width = Rect.right - Rect.left;
243 height = Rect.bottom - Rect.top;
244 }
245 } else {
246 if (win == HWND_DESKTOP) {
247 // Floating without border (popup, tooltip)
248 dwStyle = WS_POPUP;
249 dwExStyle = WS_EX_TOPMOST | WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW;
250 } else {
251 // Embedded widget
252 dwStyle = WS_CHILD;
253 dwExStyle = WS_EX_CONTROLPARENT | WS_EX_TOOLWINDOW;
254 }
255 }
256 // create the window
257 w->widget = CreateWindowEx(dwExStyle, szMainUIClassName,
258 TEXT("Draw Surface"), // lpWindowName
259 dwStyle, // dwStyle
260 CW_USEDEFAULT, CW_USEDEFAULT, // X, Y
261 width, height, // nWidth, nHeight
262 win, // hWndParent (no embeddeding takes place yet)
263 NULL, hInstance, (LPVOID)w); // hMenu, hInstance, lpParam
264 SetParent(w->widget, win); // embed into parentWindow
265 SetMouseTracking(w->widget, true); // for receiving WM_MOUSELEAVE
266
267 os_set_window_min_size(w, width/2, height/2, width, height);
268}
Childlist_t * childlist
Definition xputty.h:230
void childlist_add_child(Childlist_t *childlist, Widget_t *child)
childlist_add_child - internal use to add a child to the Childlist_t You usually didn't need to cal...
Definition xchildlist.c:42
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
void os_set_window_min_size(Widget_t *w, int min_width, int min_height, int base_width, int base_height)
os_set_window_min_size - Set the min and base size of a Widget_t
TCHAR szMainUIClassName[]
TCHAR szWidgetUIClassName[]
BOOL SetMouseTracking(HWND hwnd, BOOL enable)

References Xputty::childlist, childlist_add_child(), Xputty::dpy, os_set_window_min_size(), SetMouseTracking(), Widget_t::surface, szMainUIClassName, szWidgetUIClassName, Widget_t::widget, WndProc(), Widget_t::xic, and Widget_t::xim.

Referenced by create_window().

◆ os_create_widget_window_and_surface()

void os_create_widget_window_and_surface ( Widget_t w,
Xputty app,
Widget_t parent,
int  x,
int  y,
int  width,
int  height 
)

os_create_main_widget_and_surface - create a Widget_t with a acairo surface this function is used mainly internal on create_widget()

Parameters
*w- the Widget_t to create
*app- the Xputty struct the Widget_t belongs to
*parent- the Parent Widget_t were the Widget_t belongs to
x,y- the position related to the Parent Widget_t
*width,*height- the Widget_t size

Definition at line 270 of file xwidget-mswin.c.

271 {
272 // Event callbacks already start during CreateWindow(),
273 // so prepare childlist before that call on MSWin
274 // (on Linux, adding to childlist starts message events)
276 // prepare window class
277 WNDCLASS wndclass = {0};
278 HINSTANCE hInstance = NULL;
279
280 // create a permanent surface for drawing (see onPaint() event)
281 w->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
282
283 wndclass.style = CS_DBLCLKS;
284 wndclass.lpfnWndProc = WndProc;
285 wndclass.hInstance = hInstance;
286 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
287 wndclass.hbrBackground = NULL;
288 wndclass.lpszClassName = szWidgetUIClassName;
289 wndclass.cbWndExtra = sizeof(w); // reserve space for SetWindowLongPtr
290 RegisterClass(&wndclass);
291 // create the window
292 DWORD dwExStyle = WS_EX_CONTROLPARENT;
293 w->widget = CreateWindowEx(dwExStyle, szWidgetUIClassName,
294 TEXT("Draw Surface"), // lpWindowName
295 WS_CHILD, // dwStyle
296 x, y, // X, Y
297 width, height, // nWidth, nHeight
298 parent->widget, // hWndParent (no embeddeding takes place yet)
299 NULL, hInstance, (LPVOID)w); // hMenu, hInstance, lpParam
300
301 SetParent(w->widget, parent->widget); // embed into parentWindow
302 SetMouseTracking(w->widget, true); // for receiving WM_MOUSELEAVE
303}

References Xputty::childlist, childlist_add_child(), Xputty::dpy, SetMouseTracking(), Widget_t::surface, szWidgetUIClassName, Widget_t::widget, WndProc(), Widget_t::xic, and Widget_t::xim.

Referenced by create_widget().

◆ os_destroy_window()

void os_destroy_window ( Widget_t w)

os_destroy_window - destroy a widget (close and remove from processing)

Parameters
*w- widget to destroy

Definition at line 122 of file xwidget-mswin.c.

122 {
123 // mswin automatically sends WM_DESTROY to all child windows
124 // floating windows need to be handled manually
125 if (w && (IsWindow(w->widget))) {
126 //debug_print("os_destroy_window:DestroyWindow:hwnd=%p\n",(w)?w->widget:NULL);
127 DestroyWindow(w->widget);
128 } else {
129 debug_print("os_destroy_window:DestroyWindow:NOTFOUND:hwnd=%p\n",(w)?w->widget:NULL);
130 }
131}

References Widget_t::app, Xputty::dpy, Widget_t::widget, Widget_t::xic, and Widget_t::xim.

Referenced by destroy_widget().

◆ os_expose_widget()

void os_expose_widget ( Widget_t w)

os_expose_widget - Draw the the back buffer to the Widget_t surface

Parameters
*w- Pointer to the widget

Definition at line 327 of file xwidget-mswin.c.

327 {
328 RedrawWindow(w->widget, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW);
329}

References Widget_t::app, Xputty::dpy, Widget_t::widget, and XEvent::window.

Referenced by _update_view(), and expose_widget().

◆ os_free_pixmap()

void os_free_pixmap ( Widget_t w,
Pixmap  pixmap 
)

os_free_pixmap - Free the memory used by a Pixmap only Linux, stub otherwise

Parameters
*w- Pointer to the widget
pixmap- the pixmap to be freed

Definition at line 416 of file xwidget-mswin.c.

416 {
417 // Pixmap stuff not implemented at all
418}

References Widget_t::app, and Xputty::dpy.

◆ os_get_home_dir()

char * os_get_home_dir ( )

os_get_home_dir - get the users home directory

Returns
*char - return the users home directory must be freed by the caller

Definition at line 376 of file xwidget-mswin.c.

376 {
377 char *pPath = NULL;
378 asprintf(&pPath, "%s%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));
379 assert(pPath != NULL);
380 fprintf(stderr, "%s\n", pPath);
381 return pPath;
382}
int asprintf(char *strp[], const char *fmt,...)
Definition xasprintf.c:36

References asprintf().

◆ os_get_keyboard_input()

bool os_get_keyboard_input ( Widget_t w,
XKeyEvent key,
char *  buf,
size_t  bufsize 
)

os_ get_keyboard_input - Get the Keyboard input and convert it to utf8

Parameters
*w- Pointer to the widget
*key- the XKeyEvent
*buf- the buffer to write the key in utf8 format
bufsize- the max buffer size to write to
Returns
bool - retrun true when the char is written to the buffer false on error

Definition at line 404 of file xwidget-mswin.c.

404 {
405 char ansibuf[2];
406 ansibuf[0] = (char)key->vk;
407 ansibuf[1] = 0;
408 char *utf8 = utf8_from_locale(ansibuf);
409 int l=min(bufsize, strlen(utf8));
410 strncpy(buf, utf8, l);
411 buf[l] = 0;
412 free(utf8);
413 return key->vk_is_final_char; // for only feeding readily processed chars into input widgets
414}

References utf8_from_locale(), XEvent::vk, XEvent::vk_is_final_char, and Widget_t::xic.

◆ os_get_root_window()

Window os_get_root_window ( Xputty main,
int  flag 
)

os_get_root_window - get a pointer to the root window (desktop)

Parameters
*main- pointer to the Xputty struct
flag- Could be IS_WIDGET for NO decorated windows (popup etc.)
  • or IS_WINDOW for decorated TopLevel Windows (Dialogs, MainWindow, etc)
Returns
WINDOW - return pointer to the parent Window to use

Definition at line 133 of file xwidget-mswin.c.

133 {
134 if (flag & IS_WIDGET) return HWND_DESKTOP; // no decorated
135 else return (HWND)-1; // decorated
136}
@ IS_WIDGET
Definition xwidget.h:388

References Xputty::dpy, and IS_WIDGET.

Referenced by _configure_combobox_menu(), _configure_menu(), _popup_spinbox(), add_popup_spinbox(), create_combobox_menu(), create_menu(), create_tooltip(), mk_open_midi_keyboard(), open_directory_dialog(), open_file_dialog(), open_message_dialog(), open_midi_keyboard(), and save_file_dialog().

◆ os_get_screen_height()

int os_get_screen_height ( Widget_t w)

os_get_screen_height - Get the height of the used Display

Parameters
*w- Pointer to the widget
Returns
int - the height of the Display

Definition at line 368 of file xwidget-mswin.c.

368 {
369 return GetSystemMetrics(SM_CYSCREEN);
370}

References Widget_t::app, and Xputty::dpy.

Referenced by _configure_combobox_menu(), and _configure_menu().

◆ os_get_screen_width()

int os_get_screen_width ( Widget_t w)

os_get_screen_width - Get the width of the used Display

Parameters
*w- Pointer to the widget
Returns
int - the width of the Display

Definition at line 372 of file xwidget-mswin.c.

372 {
373 return GetSystemMetrics(SM_CXSCREEN);
374}

References Widget_t::app, and Xputty::dpy.

◆ os_get_surface_size()

void os_get_surface_size ( cairo_surface_t *  surface,
int *  width,
int *  height 
)

os_get_surface_size - get the size of the cairo surface

Parameters
*surface- the cairo surface
*width,*height- (Pointer) to get the size

Definition at line 182 of file xwidget-mswin.c.

182 {
183 *width = cairo_image_surface_get_width(surface);
184 *height = cairo_image_surface_get_height(surface);
185}

Referenced by _draw_frame(), _draw_h_meter(), _draw_image(), _draw_image_button(), _draw_image_button_with_label(), _draw_image_knob(), _draw_image_slider(), _draw_playhead(), and _draw_v_meter().

◆ os_get_window_metrics()

void os_get_window_metrics ( Widget_t w,
Metrics_t metrics 
)

os_get_window_metrics - Get the Merics_t struct related to a Widget_t

Parameters
*w- Pointer to the widget
*metrics- Pointer to the Metrics_t struct to hold the info for widget

Definition at line 146 of file xwidget-mswin.c.

146 {
147 RECT WindowRect;
148 RECT ClientRect;
149 POINT Point;
150 Widget_t *parent = (Widget_t *)w_->parent;
151
152 if (GetWindowRect(w_->widget, &WindowRect) \
153 && GetClientRect(w_->widget, &ClientRect)) {
154 Point.x = WindowRect.left; // WindowRect has correct coords, but wrong width/height
155 Point.y = WindowRect.top; // ClientRect has correct width/height, but top/left == 0
156 ScreenToClient(parent->widget, &Point); // "parent" is intentional (coords are relative to owner widget)
157 metrics->x = Point.x;
158 metrics->y = Point.y;
159 metrics->width = ClientRect.right - ClientRect.left;
160 metrics->height = ClientRect.bottom - ClientRect.top;
161 }
162 metrics->visible = IsWindowVisible(w_->widget);
163}
void * parent
Definition xwidget.h:471

References Widget_t::app, Xputty::dpy, Metrics_t::height, Widget_t::parent, Metrics_t::visible, Widget_t::widget, Metrics_t::width, Metrics_t::x, and Metrics_t::y.

Referenced by _buttons_released(), _combobox_entry_released(), _combobox_key_pressed(), _combobox_motion(), _configure_listbox(), _configure_listview(), _configure_menu(), _draw_accel_check_item(), _draw_accel_item(), _draw_base_button(), _draw_button(), _draw_buttons(), _draw_check_box(), _draw_check_button(), _draw_check_item(), _draw_combobox(), _draw_combobox_button(), _draw_combobox_entrys(), _draw_combobox_menu_slider(), _draw_frame(), _draw_h_meter(), _draw_hmeter_scale(), _draw_hslider(), _draw_image(), _draw_item(), _draw_knob(), _draw_label(), _draw_list(), _draw_listbox_item(), _draw_listbox_viewslider(), _draw_listviewslider(), _draw_menu_label(), _draw_menu_slider(), _draw_multi_list(), _draw_multi_listviewslider(), _draw_on_off_button(), _draw_spinbox(), _draw_submenu(), _draw_switch_image_button(), _draw_tabbox(), _draw_ti_button(), _draw_tooltip(), _draw_tuner(), _draw_v_meter(), _draw_value_item(), _draw_valuedisplay(), _draw_vmeter_scale(), _draw_vslider(), _draw_waveview(), _enter_submenu(), _has_pointer(), _list_entry_double_clicked(), _list_entry_released(), _list_key_pressed(), _list_motion(), _multi_list_entry_double_clicked(), _multi_list_entry_released(), _multi_list_key_pressed(), _reconfigure_combobox_viewport(), _reconfigure_listbox_viewport(), _reconfigure_listview_viewport(), _reconfigure_multi_listview_viewport(), _set_listbox_viewpoint(), _set_viewpoint(), _tab_button_released(), _update_list_view(), _update_view(), cmenu_add_submenu(), configure_event(), draw_hyperlink(), listview_remove_list(), menu_add_item(), menu_add_numeric_items(), menu_add_submenu(), menu_add_value_entry(), menubar_add_menu(), mk_draw_knob(), multi_listview_remove_list(), set_pattern(), tabbox_add_tab(), transparent_draw(), and widget_draw().

◆ os_grab_pointer()

int os_grab_pointer ( Widget_t w)

os_grab_pointer - grab the mouse pointer. Works only on linux

Parameters
*w- Pointer to the widget which will grab the mouse
Returns
int - Return 0 on error

Definition at line 351 of file xwidget-mswin.c.

351 {
352 // STUB
353 return 0;
354}

References Widget_t::app, and Xputty::dpy.

Referenced by _popup_spinbox(), pop_combobox_menu_show(), and pop_menu_show().

◆ os_init_dnd()

void os_init_dnd ( Xputty main)

◆ os_is_directory()

bool os_is_directory ( const char *  filename)

os_is directory - check if a given path is a directory or a file

Parameters
*filename- the Path to check
Returns
bool - return true if path is directory, otrherwise false

Definition at line 384 of file xwidget-mswin.c.

384 {
385 DWORD attribs = GetFileAttributes(filename);
386 return ((attribs != INVALID_FILE_ATTRIBUTES) && // check if a valid file
387 ((attribs & FILE_ATTRIBUTE_DIRECTORY) != 0) && // file is a directory
388 ((attribs & FILE_ATTRIBUTE_HIDDEN) == 0) && // file is not hidden
389 ((attribs & FILE_ATTRIBUTE_SYSTEM) == 0)); // file is not system
390}

Referenced by _draw_list(), and _draw_multi_list().

◆ os_main_run()

void os_main_run ( Xputty main)

os_main_run - start the event loop

Parameters
*main- pointer to the Xputty struct

Definition at line 458 of file xwidget-mswin.c.

458 {
459 MSG msg;
460 BOOL bRet;
461 while( main->run && (bRet = GetMessage(&msg, NULL, 0, 0)) > 0) {
462 if (bRet == -1) {
463 return; // error
464 } else {
465 TranslateMessage(&msg);
466 DispatchMessage(&msg);
467 }
468 }
469}
bool run
Definition xputty.h:256

References Func_t::button_press_callback, Func_t::button_release_callback, Xputty::childlist, Widget_t::childlist, childlist_find_widget(), childlist_has_child(), Childlist_t::childs, destroy_widget(), Xputty::dpy, Childlist_t::elem, Widget_t::event_callback, Widget_t::flags, Widget_t::func, HIDE_ON_DELETE, Xputty::hold_grab, IS_POPUP, Func_t::key_press_callback, Func_t::key_release_callback, Xputty::key_snooper, Xputty::run, Xputty::submenu, Widget_t::widget, widget_hide(), and XEvent::window.

Referenced by main_run().

◆ os_move_window()

void os_move_window ( Display dpy,
Widget_t w,
int  x,
int  y 
)

os_move_window - Move a Widget_t

Parameters
*dpy- Pointer to the Display the widget belongs to
*w- Pointer to the widget
x,y- the point to move to

Definition at line 172 of file xwidget-mswin.c.

172 {
173 SetWindowPos(w->widget, NULL, //hWnd, hWndInsertAfter
174 x, y, 0, 0, SWP_NOSIZE|SWP_NOZORDER); //X, Y, width, height, uFlags
175}

References Widget_t::widget.

Referenced by _configure_combobox_menu(), _configure_menu(), _popup_spinbox(), _resize_childs(), _set_listbox_viewpoint(), _set_viewpoint(), and menu_remove_item().

◆ os_open_display()

Display * os_open_display ( char *  display_name)

os_open_display - Connect to the display to use

Parameters
*display_name- Display name could be 0 for default
Returns
Display - return pointer to the Display struct

Definition at line 113 of file xwidget-mswin.c.

113 {
114 // nothing to do on MSWin
115 return (Display *)1;
116}
XID Display

Referenced by main_init().

◆ os_quit()

void os_quit ( Widget_t w)

os_quit - quit the main loop and free all used memory

Parameters
*w- Pointer to the widget request the quit call

Definition at line 420 of file xwidget-mswin.c.

420 {
421 if (w) {
422 WPARAM wParam = (WPARAM)get_toplevel_widget(w->app)->widget;
423 DWORD msg = os_register_wm_delete_window(w);
424 SendMessage(w->widget, msg, wParam, 0); // WM_DELETE_WINDOW
425 }
426 // UnregisterClass silently fails, if there are still more windows of this class
427 if (UnregisterClass(szMainUIClassName, NULL)) {
428 debug_print("UnregisterMainClass:%s:OK\n", szMainUIClassName);
429 } else
430 debug_lasterror("UnregisterMainClass:", szMainUIClassName);
431
432 if (UnregisterClass(szWidgetUIClassName, NULL)) {
433 debug_print("UnregisterWidgetClass:%s:OK\n", szWidgetUIClassName);
434 } else
435 debug_lasterror("UnregisterWidgetClass" ,szWidgetUIClassName);
436
437}
Xputty * app
Definition xwidget.h:465
void debug_lasterror(const char *prefix, const char *prefix2)
Atom os_register_wm_delete_window(Widget_t *wid)
os_register_wm_delete_window - Get the needed Atom to send a widget delete message
Widget_t * get_toplevel_widget(Xputty *main)
*get_toplevel_widget - get pointer to the top level Widget_t
Definition xwidget.c:441

References Widget_t::app, debug_lasterror(), Xputty::dpy, get_toplevel_widget(), os_register_wm_delete_window(), szMainUIClassName, szWidgetUIClassName, and Widget_t::widget.

Referenced by quit(), and quit_widget().

◆ os_quit_widget()

void os_quit_widget ( Widget_t w)

os_quit_widget - remove a Widget_t from the main loop and free it's used memory

Parameters
*w- Pointer to the widget request the quit call

Definition at line 439 of file xwidget-mswin.c.

439 {
440 // who invokes this?
441 WPARAM wParam = (WPARAM)w->widget;
442 DWORD msg = os_register_widget_destroy(w);
443 SendMessage(w->widget, msg, wParam, 0); // WIDGET_DESTROY
444}
Atom os_register_widget_destroy(Widget_t *wid)
os_register_widget_destroy - Get the needed Atom to send a widget destroy message

References Widget_t::app, Xputty::dpy, os_register_widget_destroy(), and Widget_t::widget.

◆ os_register_widget_destroy()

Atom os_register_widget_destroy ( Widget_t wid)

os_register_widget_destroy - Get the needed Atom to send a widget destroy message

Parameters
*wid- Pointer to the widget request the quit call
Returns
ATOM - ATOM on linux, DWORD on windows

Definition at line 452 of file xwidget-mswin.c.

452 {
453 Atom msg = WM_USER + 02 ;
454 //Atom msg = RegisterWindowMessage("XPUTTY_WIDGET_DESTROY");
455 return msg;
456}
unsigned long int Atom

References Widget_t::app, and Xputty::dpy.

Referenced by os_quit_widget().

◆ os_register_wm_delete_window()

Atom os_register_wm_delete_window ( Widget_t wid)

os_register_wm_delete_window - Get the needed Atom to send a widget delete message

Parameters
*wid- Pointer to the widget request the quit call
Returns
ATOM - ATOM on linux, DWORD on windows

Definition at line 446 of file xwidget-mswin.c.

446 {
447 Atom msg = WM_USER + 01;
448 //Atom msg = RegisterWindowMessage("XPUTTY_WM_DELETE_WINDOW");
449 return msg;
450}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by childlist_add_child(), and os_quit().

◆ os_resize_window()

void os_resize_window ( Display dpy,
Widget_t w,
int  x,
int  y 
)

os_resize_window - Resize a Widget_t

Parameters
*dpy- Pointer to the Display the widget belongs to
*w- Pointer to the Widget_t
x,y- the new size

Definition at line 177 of file xwidget-mswin.c.

177 {
178 SetWindowPos(w->widget, NULL, //hWnd, hWndInsertAfter
179 0, 0, x, y, SWP_NOMOVE|SWP_NOZORDER); //X, Y, width, height, uFlags
180}

References Widget_t::widget.

Referenced by _configure_combobox_menu(), _configure_listbox(), _configure_listview(), _configure_menu(), _get_width(), and _resize_childs().

◆ os_run_embedded()

void os_run_embedded ( Xputty main)

os_run_embedded - the event handling when run embedded on windows all messges goes into WndProc, so stub here

Parameters
*main- pointer to the Xputty struct

Definition at line 471 of file xwidget-mswin.c.

471 {
472 // messageloop already polled by plugin host
473}

References Func_t::button_press_callback, Func_t::button_release_callback, Xputty::childlist, Widget_t::childlist, childlist_find_widget(), childlist_has_child(), Childlist_t::childs, destroy_widget(), Xputty::dpy, Childlist_t::elem, Widget_t::event_callback, Widget_t::flags, Widget_t::func, HIDE_ON_DELETE, Xputty::hold_grab, IS_POPUP, Func_t::key_press_callback, Func_t::key_release_callback, Xputty::key_snooper, Xputty::submenu, Widget_t::widget, widget_hide(), and XEvent::window.

Referenced by run_embedded().

◆ os_send_button_press_event()

void os_send_button_press_event ( Widget_t w)

os_send_button_press_event - Send a button press event to a Widget_t see XButtonEvent

Parameters
*w- Pointer to the widget

Definition at line 339 of file xwidget-mswin.c.

339 {
340 // STUB
341}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by send_button_press_event().

◆ os_send_button_release_event()

void os_send_button_release_event ( Widget_t w)

os_send_button_release_event - Send a button release event to a Widget_t see XButtonEvent

Parameters
*w- Pointer to the widget

Definition at line 343 of file xwidget-mswin.c.

343 {
344 // STUB
345}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by send_button_release_event().

◆ os_send_configure_event()

void os_send_configure_event ( Widget_t w,
int  x,
int  y,
int  width,
int  height 
)

os_send_configure_event - Send a configure event to a Widget_t

Parameters
*w- Pointer to the widget
x,y- the position to set
width,height- the size to set

Definition at line 335 of file xwidget-mswin.c.

335 {
336 // STUB
337}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by send_configure_event().

◆ os_send_systray_message()

void os_send_systray_message ( Widget_t w)

os_send_send_systray_message - Send a systray event to a Widget_t only working on Linux for now

Parameters
*w- Pointer to the widget

Definition at line 347 of file xwidget-mswin.c.

347 {
348 // STUB
349}

References Widget_t::app, default_error_handler, Xputty::dpy, intern_error_handler(), set_systray_color(), and Widget_t::widget.

Referenced by send_systray_message().

◆ os_set_input_mask()

void os_set_input_mask ( Widget_t w)

os_set_input_mask - set the Event mask to a Widget_t only work on linux, stub on Windows

Parameters
*w- Pointer to the widget which will grab the mouse

Definition at line 356 of file xwidget-mswin.c.

356 {
357 // STUB
358}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by add_midi_keyboard(), create_combobox_viewport(), create_listview_viewport(), create_multi_listview_viewport(), mk_open_midi_keyboard(), and open_midi_keyboard().

◆ os_set_title()

void os_set_title ( Widget_t w,
const char *  title 
)

os_set_title - Set the title of a Widget_t

Parameters
*w- Pointer to the widget
title- the title to set

Definition at line 305 of file xwidget-mswin.c.

305 {
306 if (title)
307 SetWindowText(w->widget, title);
308}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by widget_set_title().

◆ os_set_transient_for_hint()

void os_set_transient_for_hint ( Widget_t parent,
Widget_t w 
)

os_set_ transient_for_hint - set a Widget_t transient to a other Widget_t only work on linux, stub on Windows

Parameters
*parent- Pointer to the parent widget
*w- Pointer to the widget

Definition at line 364 of file xwidget-mswin.c.

364 {
365 // STUB
366}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by add_popup_spinbox(), create_combobox_menu(), create_menu(), and create_tooltip().

◆ os_set_widget_surface_size()

void os_set_widget_surface_size ( Widget_t w,
int  width,
int  height 
)

os_set_widget_surface_size - set the size of a Widget_t cairo surface

Parameters
*w- Pointer to the Widget_t the surface belongs to
*width,*height- the size to set

Definition at line 187 of file xwidget-mswin.c.

187 {
188 // image_surface cant be resized (only xlib_surface can)
189 cairo_destroy(w->cr);
190 cairo_surface_destroy(w->surface);
191 w->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
192 w->cr = cairo_create(w->surface);
193}
cairo_t * cr
Definition xwidget.h:485

References Widget_t::cr, and Widget_t::surface.

Referenced by _resize_surface().

◆ os_set_window_attrb()

void os_set_window_attrb ( Widget_t w)

os_set_window_attrb - set the attribute mask to a Widget_t only work on linux, stub on Windows

Parameters
*w- Pointer to the widget which will grab the mouse

Definition at line 360 of file xwidget-mswin.c.

360 {
361 // STUB
362}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by add_popup_spinbox(), create_combobox_menu(), create_menu(), and create_tooltip().

◆ os_set_window_min_size()

void os_set_window_min_size ( Widget_t w,
int  min_width,
int  min_height,
int  base_width,
int  base_height 
)

os_set_window_min_size - Set the min and base size of a Widget_t

Parameters
*w- Pointer to the widget
min_width,min_height- the min size to set
base_width,base_height- the base size to set

Definition at line 166 of file xwidget-mswin.c.

167 {
168 w->metrics_min.width = min_width;
169 w->metrics_min.height = min_height;
170}
Metrics_t metrics_min
Definition xwidget.h:530

References Widget_t::app, Xputty::dpy, Metrics_t::height, Widget_t::metrics_min, Widget_t::widget, and Metrics_t::width.

Referenced by os_create_main_window_and_surface().

◆ os_show_tooltip()

void os_show_tooltip ( Widget_t wid,
Widget_t w 
)

os_show_tooltip - Show a tooltip of a Widget_t

Parameters
*wid- Pointer to the widget the tooltip belongs to
*w- the tooltip Widget_t

Definition at line 318 of file xwidget-mswin.c.

318 {
319 POINT pt;
320 if (GetCursorPos(&pt)) {
321 SetWindowPos(w->widget, NULL, //hWnd, hWndInsertAfter
322 pt.x+10, pt.y-10, 0, 0,
323 SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_SHOWWINDOW); //X, Y, width, height, uFlags
324 }
325}

References Widget_t::app, Xputty::dpy, IS_WIDGET, os_get_root_window(), os_translate_coords(), and Widget_t::widget.

Referenced by show_tooltip().

◆ os_translate_coords()

void os_translate_coords ( Widget_t w,
Window  from_window,
Window  to_window,
int  from_x,
int  from_y,
int *  to_x,
int *  to_y 
)

os_translate_coords - get x,y related to destination Window

Parameters
*w- Widget_t pointer
from_window- source Window
to_window- destination Window
from_x,from_y- point from the source Window
*to_x,*to_y- (Pointer) point in the destination Window

Definition at line 138 of file xwidget-mswin.c.

139 {
140 POINT Point = {from_x, from_y};
141 MapWindowPoints(from_window, to_window, &Point, 1);
142 *to_x = Point.x;
143 *to_y = Point.y;
144}

References Widget_t::app, and Xputty::dpy.

Referenced by _configure_combobox_menu(), _configure_menu(), _popup_spinbox(), add_popup_spinbox(), create_combobox_menu(), create_menu(), and create_tooltip().

◆ os_transparent_draw()

void os_transparent_draw ( void *  w_,
void *  user_data 
)

os_transparent_draw - Draw the Widget_t to the back buffer

Parameters
*w_- Pointer to the widget
*user_data- additional user data or NULL

Definition at line 392 of file xwidget-mswin.c.

392 {
393 Widget_t *w = (Widget_t *)w_;
394 // transparent_draw(w, user_data);
395 RedrawWindow(w->widget, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
396}

References transparent_draw(), and Widget_t::widget.

Referenced by _check_menu_state(), _enter_submenu(), _leave_submenu(), _set_entry(), add_button(), add_check_box(), add_check_button(), add_combobox(), add_hslider(), add_image_button(), add_image_knob(), add_image_toggle_button(), add_knob(), add_menu(), add_on_off_button(), add_switch_image_button(), add_toggle_button(), add_valuedisplay(), add_vslider(), create_widget(), listbox_add_entry(), menu_add_item(), menu_add_numeric_items(), and menu_add_value_entry().

◆ os_widget_event_loop()

void os_widget_event_loop ( void *  w_,
void *  event,
Xputty main,
void *  user_data 
)

os_widget_event_loop - the Widget_t event loop on windows all messges goes into WndProc, so stub here

Parameters
*w_- Pointer to the widget
*event- the event to handle
*main- pointer to the Xputty struct
*user_data- additional user data could be NULL

Definition at line 331 of file xwidget-mswin.c.

331 {
332 // nothing to do
333}

References _button_press(), _check_enum(), _check_grab(), _check_keymap(), _check_submenu(), _has_pointer(), _hide_all_tooltips(), adj_set_motion_state(), Widget_t::app, XEvent::button, Func_t::button_release_callback, Widget_t::childlist, childlist_has_child(), Childlist_t::childs, Func_t::configure_callback, destroy_widget(), Xputty::dnd_source_window, Xputty::dnd_type, Xputty::dnd_version, Widget_t::double_click, Func_t::double_click_callback, Xputty::dpy, Func_t::enter_callback, FAST_REDRAW, Widget_t::flags, Widget_t::func, handle_dnd_enter(), handle_drag_data(), HAS_FOCUS, HAS_POINTER, HAS_TOOLTIP, hide_tooltip(), IS_POPUP, Func_t::key_press_callback, Func_t::key_release_callback, XEvent::keycode, Func_t::leave_callback, Func_t::motion_callback, NO_AUTOREPEAT, quit_widget(), receive_paste_from_clipboard(), Xputty::selection, send_dnd_finished_event(), send_dnd_status_event(), send_to_clipboard(), show_tooltip(), XEvent::state, Widget_t::state, transparent_draw(), Func_t::visibiliy_change_callback, Widget_t::widget, XEvent::x, Xputty::XdndDrop, Xputty::XdndEnter, Xputty::XdndLeave, Xputty::XdndPosition, Xputty::XdndSelection, Widget_t::xpaste_callback, and XEvent::y.

Referenced by create_widget(), and widget_event_loop().

◆ os_widget_hide()

void os_widget_hide ( Widget_t w)

os_widget_hide - Hide a Widget_t

Parameters
*w- Pointer to the widget to hide

Definition at line 314 of file xwidget-mswin.c.

314 {
315 ShowWindow(w->widget, SW_HIDE);
316}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by widget_hide(), and widget_hide_all().

◆ os_widget_show()

void os_widget_show ( Widget_t w)

os_widget_show - Show a Widget_t

Parameters
*w- Pointer to the widget to show

Definition at line 310 of file xwidget-mswin.c.

310 {
311 ShowWindow(w->widget, SW_SHOW);
312}

References Widget_t::app, Xputty::dpy, and Widget_t::widget.

Referenced by pop_widget_show_all(), submenu_widget_show_all(), widget_show(), and widget_show_all().

◆ SetClientSize()

void SetClientSize ( HWND  hwnd,
int  clientWidth,
int  clientHeight 
)

Definition at line 996 of file xwidget-mswin.c.

996 {
997 if (IsWindow(hwnd)) {
998 DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE) ;
999 DWORD dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE) ;
1000 HMENU menu = GetMenu(hwnd) ;
1001 RECT rc = {0, 0, clientWidth, clientHeight} ;
1002 AdjustWindowRectEx(&rc, dwStyle, menu ? TRUE : FALSE, dwExStyle);
1003 SetWindowPos(hwnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
1004 SWP_NOZORDER | SWP_NOMOVE) ;
1005 }
1006}

Referenced by WndProc().

◆ SetMouseTracking()

BOOL SetMouseTracking ( HWND  hwnd,
BOOL  enable 
)

Definition at line 1009 of file xwidget-mswin.c.

1009 {
1010 TRACKMOUSEEVENT tme;
1011
1012 tme.cbSize = sizeof(tme);
1013 tme.dwFlags = TME_LEAVE;
1014 if (!enable)
1015 tme.dwFlags |= TME_CANCEL;
1016 tme.hwndTrack = hwnd;
1017 tme.dwHoverTime = HOVER_DEFAULT;
1018 return TrackMouseEvent(&tme);
1019}

Referenced by os_create_main_window_and_surface(), os_create_widget_window_and_surface(), and WndProc().

◆ utf8_from_locale()

char * utf8_from_locale ( char *  localestr)

utf8_from_locale - convert active codepage to utf8 must be freed by the caller

Parameters
*localestr- Pointer to char to convert
Returns
*char - the converted char in utf8 format

Definition at line 104 of file xwidget-mswin.c.

104 {
105 return (convert_cp(GetACP(), CP_UTF8, localestr));
106}

References asprintf(), and convert_cp().

Referenced by _draw_multi_list(), HandleFiles(), and os_get_keyboard_input().

◆ WndProc()

LRESULT CALLBACK WndProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 562 of file xwidget-mswin.c.

563{
564 POINT pt;
565 XButtonEvent xbutton;
566 XMotionEvent xmotion;
567 XKeyEvent xkey;
568 void *user_data = NULL;
569
570 // be aware: "wid" can be NULL during window creation (esp. if there is a debugger attached)
571 Widget_t *wid = (Widget_t *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
572 Xputty *main = wid ? wid-> app : NULL;
573
574 xbutton.window = hwnd;
575 xbutton.x = GET_X_LPARAM(lParam);
576 xbutton.y = GET_Y_LPARAM(lParam);
577 xmotion.window = hwnd;
578 xmotion.x = GET_X_LPARAM(lParam);
579 xmotion.y = GET_Y_LPARAM(lParam);
580
581 switch (msg) {
582 case WM_CREATE:
583 debug_print("WM:WM_CREATE:hwnd=%p:wid=%p",hwnd,wid);
584 {
585 CREATESTRUCT *pCreate = (CREATESTRUCT *)lParam;
586 wid = (Widget_t *)pCreate->lpCreateParams;
587 // CreateWindowEx() hasnt returned yet, so wid->widget is not set
588 wid->widget = hwnd;
589 // make "wid" available in messageloop events via GetWindowLongPtr()
590 SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)wid);
591 }
592 return 0;
593
594 // MSWin only: React to close requests
595 case WM_CLOSE:
596 // standalone
597 if (hwnd == main->childlist->childs[0]->widget) {
598 // is main window: end application
599 PostQuitMessage(0); // end messageloop (continuing to main_quit())
600 } else // is sub window (menu, dialog, ...): close
601 DestroyWindow(hwnd);
602 return 0;
603 case WM_DESTROY:
604 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
605 return 0;
606
607 // X11:ConfigureNotify
608 case WM_SIZE:
609 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
610 else {
611 if(wid->app->hold_grab && wid != wid->app->hold_grab) {
613 wid->app->hold_grab = NULL;
614 }
615 // Limit window size:
616 // The plugin doesnt receive WM_MINMAXINFO or WM_SIZING.
617 // SWP_NOSIZE in WM_WINDOWPOSCHANGING cant handle width/height separately.
618 // Setting the client size afterwards turned out to be the best working option so far.
619 // Plugin: Limits the "zoom" (as the hosts window can always become smaller)
620 // Standalone: Limits the window size
621 int width = LOWORD(lParam);
622 int height = HIWORD(lParam);
623 if ((width < wid->metrics_min.width)
624 || (height < wid->metrics_min.height)) {
625 SetClientSize(hwnd, max(width, wid->metrics_min.width),
626 max(height, wid->metrics_min.height));
627 return 0;
628 }
629 // Resize handler
630 if (!wid->func.configure_callback) return 0;
631 wid->func.configure_callback(wid, user_data);
632 // widgets recive the call to os_transparent_draw via the configure_notify_callback
633 // windows have the CS_HREDRAW | CS_VREDRAW flags set so that they be redrawn by the system
634 return 0;
635 }
636
637 case WM_MOVE:
638 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
639 if(wid->app->hold_grab && wid != wid->app->hold_grab) {
641 wid->app->hold_grab = NULL;
642 }
643 // X11:Expose
644 case WM_PAINT:
645 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
646 if (!(wid->crb)) {
647 debug_print("WM_PAINT:BAILOUT:wid->crb==NULL\n");
648 return 0;
649 }
650 return onPaint(hwnd, wParam, lParam); // not possible on mswin: (only fetch the last expose event)
651
652 // MSWin only: Allow keyboard input
653 case WM_ACTIVATE:
654 SetFocus(hwnd);
655 return 0;
656 case WM_MOUSEACTIVATE:
657 SetFocus(hwnd);
658 return MA_ACTIVATE;
659
660 // X11:ButtonPress
661 case WM_LBUTTONDOWN:
662 case WM_RBUTTONDOWN:
663 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
664 SetCapture(hwnd); // also receive WM_MOUSEMOVE from outside this window
665
666 if (msg == WM_LBUTTONDOWN)
667 xbutton.button = Button1;
668 else
669 xbutton.button = Button3;
670 if (wid->state == 4) break;
671 if (wid->flags & HAS_TOOLTIP) hide_tooltip(wid);
672 _button_press(wid, &xbutton, user_data);
673 debug_print("Widget_t ButtonPress %i\n", xbutton.button);
674 return 0;
675 case WM_MOUSEWHEEL:
676 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
677 // opposed to X11, WM_MOUSEWHEEL doesnt contain mouse coordinates
678 {
679 DWORD pos = GetMessagePos();
680 pt.x = GET_X_LPARAM(pos);
681 pt.y = GET_Y_LPARAM(pos);
682 if (ScreenToClient(hwnd, &pt)) {
683 wid->pos_x = pt.x;
684 wid->pos_y = pt.y;
685 }
686 }
687 if (GET_WHEEL_DELTA_WPARAM(wParam) <= 0) {
688 xbutton.button = Button5;
689 _button_press(wid, &xbutton, user_data);
690 } else {
691 xbutton.button = Button4;
692 _button_press(wid, &xbutton, user_data);
693 }
694 // forward WM_MOUSEWHEEL from menuitem to viewport (with slider)
695 // (viewport lies below menuitem, so doesnt receive WM_MOUSEWHEEL)
696 if(wid->app->hold_grab) {
697 Widget_t *view_port = wid->app->hold_grab->childlist->childs[0];
698 if (hwnd != view_port->widget)
699 SendMessage(view_port->widget, msg, wParam, lParam);
700 RedrawWindow(view_port->widget, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW);
701 }
702 return 0;
703 // X11:ButtonRelease
704 case WM_LBUTTONDBLCLK:
705 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
706 xbutton.button = Button1;
707 wid->func.double_click_callback(wid, &xbutton, user_data);
708 return 0;
709 case WM_LBUTTONUP:
710 case WM_RBUTTONUP:
711 ReleaseCapture();
712 if (msg == WM_LBUTTONUP)
713 xbutton.button = Button1;
714 else
715 xbutton.button = Button3;
716 _check_grab(wid, &xbutton, wid->app);
717 _check_submenu(wid, &xbutton, main);
718 if (wid->state == 4) break;
719 _has_pointer(wid, &xbutton);
720 if(wid->flags & HAS_POINTER) wid->state = 1;
721 else wid->state = 0;
722 _check_enum(wid, &xbutton);
723 wid->func.button_release_callback((void*)wid, &xbutton, user_data);
724 debug_print("Widget_t ButtonRelease %i\n", xbutton.button);
725 return 0;
726
727 // X11:KeyPress and X11:KeyRelease
728 // The resulting character (e.g. from dead-key combinations) cannot be
729 // determined from WM_KEYUP or WM_KEYDOWN: WM_CHAR has to be used instead.
730 // To workaround that, WM_CHAR fires key_press- and key_release_event()
731 // after another, with the flag "->vk_is_final_char" set, so the client
732 // code can differentiate between real KEYUP/DOWN and fake CHAR events.
733 case WM_CHAR:
734 case WM_KEYDOWN:
735 case WM_KEYUP:
736 build_xkey_event(&xkey, msg, wParam, lParam);
737 // X11:KeyPress
738 if (msg != WM_KEYUP) { // WM_KEYDOWN and WM_CHAR: key_press_callback()
739 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
740 if (wid->state == 4) return 0;
741 // on Linux, retrigger check happens in KeyRelease (WM_KEYUP)
742 unsigned short is_retriggered = 0;
743 if(wid->flags & NO_AUTOREPEAT) {
744 if ((HIWORD(lParam) & KF_REPEAT) == KF_REPEAT)
745 is_retriggered = 1;
746 }
747 if (!is_retriggered) {
748 _check_keymap(wid, xkey);
749 wid->func.key_press_callback((void *)wid, &xkey, user_data);
750 debug_print("Widget_t KeyPress %x\n", xkey.keycode);
751 }
752 }
753 //X11:KeyRelease
754 if (msg != WM_KEYDOWN) { // WM_KEYUP and WM_CHAR: key_release_callback()
755 if (wid->state == 4) return 0;
756 // On MSWin, the REPEAT flag is always set for WM_KEYUP,
757 // so the retrigger check has to take place in WM_KEYDOWN instead
758 wid->func.key_release_callback((void *)wid, &xkey, user_data);
759 debug_print("Widget_t KeyRelease %x\n", xkey.keycode);
760 }
761 return 0;
762
763 // X11:LeaveNotify (X11:EnterNotify: see WM_MOUSEMOVE)
764 case WM_MOUSELEAVE:
765 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
766 // xputty -> xwidget: handled by "ButtonPress" event on Linux
767
768 bool is_item = false;
769 GetCursorPos(&pt);
770 Window win_cur = WindowFromPoint(pt);
771 if(wid->app->submenu != NULL) {
772 if (childlist_has_child(wid->app->submenu->childlist)) {
773 Widget_t *slider = wid->app->submenu->childlist->childs[1];
774 if (win_cur == slider->widget) {
775 return 0;
776 }
777 Widget_t *view_port = wid->app->submenu->childlist->childs[0];
778 int i = view_port->childlist->elem-1;
779 for(;i>-1;i--) {
780 Widget_t *w = view_port->childlist->childs[i];
781 if (win_cur == w->widget) {
782 is_item = True;
783 break;
784 }
785 }
786 }
787 }
788 if(wid->app->hold_grab != NULL && wid->app->hold_grab->flags & IS_POPUP) {
789 if (childlist_has_child(wid->app->hold_grab->childlist)) {
790 Widget_t *slider = wid->app->hold_grab->childlist->childs[1];
791 if (win_cur == slider->widget) {
792 return 0;
793 }
794 Widget_t *view_port = wid->app->hold_grab->childlist->childs[0];
795 int i = view_port->childlist->elem-1;
796 for(;i>-1;i--) {
797 Widget_t *w = view_port->childlist->childs[i];
798 if (win_cur == w->widget) {
799 is_item = True;
800 break;
801 }
802 }
803 if (win_cur == view_port->widget) is_item = True;
804 }
805 if (!is_item && (wParam & MK_LBUTTON || wParam & MK_RBUTTON)) {
806 ReleaseCapture();
807 widget_hide(wid->app->hold_grab);
808 wid->app->hold_grab = NULL;
809 }
810 } else if(wid->app->hold_grab != NULL && ((wid->app->hold_grab->flags & IS_POPUP) == 0)) {
811 wid->app->hold_grab->func.button_press_callback(wid->app->hold_grab, &xbutton, NULL);
812 }
813
814/*
815 // close popup menu if cursor moves out of widget
816 if(wid->app->hold_grab != NULL) {
817 GetCursorPos(&pt);
818 Window win_cur = WindowFromPoint(pt);
819 bool is_item = false;
820 // still inside viewport? (finds menu entries in popup window)
821 Widget_t *view_port = wid->app->hold_grab->childlist->childs[0];
822 if (view_port) { // should never be NULL, but who knows :)
823 int i = view_port->childlist->elem-1;
824 for(;i>-1;i--) {
825 Widget_t *w = view_port->childlist->childs[i];
826 if (win_cur == w->widget) {
827 is_item = true;
828 break;
829 }
830 }
831 if (view_port && win_cur == view_port->widget) is_item = true; // inside slider area?
832 }
833 // still inside combobox? (finds combobox-button)
834 Widget_t *menu = NULL;
835 menu = (Widget_t *)wid->app->hold_grab->parent_struct;
836 if (menu) { // can be NULL if not contained in combobox
837 int i = menu->childlist->elem-1;
838 for(;i>-1;i--) {
839 Widget_t *w = menu->childlist->childs[i];
840 if (win_cur == w->widget) {
841 is_item = true;
842 break;
843 }
844 }
845 if (menu && win_cur == menu->widget) is_item = true; // inside combobox textarea?
846 }
847 if (!is_item) {
848 ReleaseCapture();
849 widget_hide(wid->app->hold_grab);
850 wid->app->hold_grab = NULL;
851 }
852 }
853*/
854 // for emulating X11:EnterNotify
855 wid->mouse_inside = false;
856
857 if (wid->state == 4) break;
858 //if(!(xev->xcrossing.state & Button1Mask)) {
859 if (!(GetAsyncKeyState(VK_LBUTTON) & 0x8000)) {
860 wid->state = 0;
861 wid->flags &= ~HAS_FOCUS;
862 wid->func.leave_callback((void*)wid, user_data);
863 // if (!(wid->flags & IS_WINDOW))
864 // RedrawWindow(hwnd, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW);
865 }
866 if (wid->flags & HAS_TOOLTIP) hide_tooltip(wid);
867 debug_print("Widget_t LeaveNotify:hwnd=%p",hwnd);
868
869 return 0;
870
871 // X11:MotionNotify
872 case WM_MOUSEMOVE:
873 if (!wid) return DefWindowProc(hwnd, msg, wParam, lParam);
874 if (!wid->mouse_inside) {
875 // emulate X11:EnterNotify
876 int ch = childlist_has_child(main->childlist);
877 if (ch) {
878 int i = ch;
879 for(;i>0;i--) {
880 if (main->childlist->childs[i-1] != wid) {
881 if (main->childlist->childs[i-1]->mouse_inside) {
882 main->childlist->childs[i-1]->mouse_inside = false;
883 if (main->childlist->childs[i-1]->state != 4) {
884 main->childlist->childs[i-1]->state = 0;
885 //RedrawWindow(main->childlist->childs[i-1]->widget, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW);
886 }
887 }
888 }
889 }
890 }
891 wid->mouse_inside = true;
892 wid->flags |= HAS_FOCUS;
893 if (wid->state == 4) break;
894
895 //if(!(xev->xcrossing.state & Button1Mask)) {
896 if (!(wParam & MK_LBUTTON)) {
897 wid->state = 1;
898 wid->func.enter_callback((void*)wid, user_data);
899 // if (!(wid->flags & IS_WINDOW))
900 // RedrawWindow(hwnd, NULL, NULL, RDW_NOERASE | RDW_INVALIDATE | RDW_UPDATENOW);
901 if (wid->flags & HAS_TOOLTIP) show_tooltip(wid);
902 else _hide_all_tooltips(wid);
903 }
904 debug_print("Widget_t EnterNotify:hwnd=%p",hwnd);
905
906 SetMouseTracking(hwnd, true); // for receiving (next) WM_MOUSELEAVE
907 }
908 // hovering, etc.
909 if (wid->state == 4) return 0;
910 if (wParam & MK_LBUTTON) // TODO: why is this if() required here, but not on linux?
911 adj_set_motion_state(wid, xmotion.x, xmotion.y);
912 wid->func.motion_callback((void*)wid, &xmotion, user_data);
913 debug_print("Widget_t MotionNotify x = %li Y = %li hwnd=%p\n",pt.x,pt.y,hwnd );
914 return 0;
915
916 case WM_DROPFILES:
917 HandleFiles(wParam, wid);
918 break;
919
920 // X11:ClientMessage: not implemented (could be done with WM_USER / RegisterWindowMessage())
921 case WM_USER + 01: // WM_DELETE_WINDOW
922 // xwidget -> xputty (main_run())
923 if (wid) {
924 if (hwnd == main->childlist->childs[0]->widget) { // main window (this is not invoked for any other window?)
925 main->run = false;
926 destroy_widget(wid, main);
927 } else {
928 int i = childlist_find_widget(main->childlist, (Window)wParam);
929 if(i<1) return 0;
930 Widget_t *w = main->childlist->childs[i];
931 if(w->flags & HIDE_ON_DELETE) widget_hide(w);
932 else { destroy_widget(main->childlist->childs[i],main);
933 }
934 }
935 }
936 return 1;
937 // X11:ClientMessage:WIDGET_DESTROY
938 case WM_USER + 02: // WIDGET_DESTROY
939 //os_widget_event_loop()
940 if (wid) {
941 int ch = childlist_has_child(wid->childlist);
942 if (ch) {
943 int i = ch;
944 for(;i>0;i--) {
945 quit_widget(wid->childlist->childs[i-1]);
946 }
947 quit_widget(wid);
948 } else {
949 destroy_widget(wid,wid->app);
950 }
951 return 0;
952 }
953 return 2;
954
955 default:
956 return DefWindowProc(hwnd, msg, wParam, lParam);
957 }
958 return 0;
959}
Widget_t ** childs
Definition xchildlist.h:51
evfunc button_release_callback
Definition xwidget.h:101
xevfunc configure_callback
Definition xwidget.h:86
evfunc double_click_callback
Definition xwidget.h:102
bool mouse_inside
Definition xwidget.h:528
int pos_y
Definition xwidget.h:515
cairo_t * crb
Definition xwidget.h:489
int state
Definition xwidget.h:511
Childlist_t * childlist
Definition xwidget.h:499
int pos_x
Definition xwidget.h:513
long long flags
Definition xwidget.h:461
int button
Window window
Xputty - the main struct. It should be declared before any other call to a Xputty function....
Definition xputty.h:228
Widget_t * hold_grab
Definition xputty.h:238
Widget_t * submenu
Definition xputty.h:242
void adj_set_motion_state(void *w, float x, float y)
adj_set_motion_state - internal use to set value and state of the Adjustment_t on mouse pointer movme...
int childlist_find_widget(Childlist_t *childlist, Window child_window)
childlist_find_widget - find a child Widget_t in a the childlist by given the Window id
Definition xchildlist.c:79
int childlist_has_child(Childlist_t *childlist)
childlist_has_child - check if a Widget_t Childlist_t contain a child
Definition xchildlist.c:89
HWND Window
void SetClientSize(HWND hwnd, int clientWidth, int clientHeight)
void HandleFiles(WPARAM wParam, Widget_t *wid)
void build_xkey_event(XKeyEvent *ev, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT onPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
void quit_widget(Widget_t *w)
quit_widget - remove a widget from the processing loop
Definition xwidget.c:530
void show_tooltip(Widget_t *wid)
show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available.
Definition xwidget.c:419
@ HIDE_ON_DELETE
Definition xwidget.h:412
@ HAS_POINTER
Definition xwidget.h:402
@ NO_AUTOREPEAT
Definition xwidget.h:408
@ HAS_TOOLTIP
Definition xwidget.h:404
@ HAS_FOCUS
Definition xwidget.h:400
@ IS_POPUP
Definition xwidget.h:392
void hide_tooltip(Widget_t *wid)
hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped.
Definition xwidget.c:430
void widget_hide(Widget_t *w)
widget_hide - unmap/hide a Widget_t
Definition xwidget.c:368
void destroy_widget(Widget_t *w, Xputty *main)
destroy_widget - destroy a widget When a Widget_t receive a destroy_widget() call,...
Definition xwidget.c:86
void _hide_all_tooltips(Widget_t *wid)
_hide_all_tooltips - hide all active tooltips
void _check_enum(Widget_t *wid, XButtonEvent *xbutton)
_check_enum - internal check if Adjustment_t is of type CL_ENUM and handle events acordingly
void _check_grab(Widget_t *wid, XButtonEvent *xbutton, Xputty *main)
_check_grab - internal check if a Widgt_t holds a grab when a BUTTON_PRESS event occur....
void _button_press(Widget_t *wid, XButtonEvent *xbutton, void *user_data)
_button_press - internal check which button is pressed (BUTTON_PRESS)
void _check_submenu(Widget_t *wid, XButtonEvent *xbutton, Xputty *main)
_check_submenu - internal check if a Widgt_t is a submenu when a BUTTON_PRESS event occur....
void _check_keymap(void *w_, XKeyEvent xkey)
_check_keymap - check if key is in map, send requests if so
void _has_pointer(Widget_t *w, XButtonEvent *button)
_has_pointer - check if the widget has the pointer

References _button_press(), _check_enum(), _check_grab(), _check_keymap(), _check_submenu(), _has_pointer(), _hide_all_tooltips(), adj_set_motion_state(), Widget_t::app, build_xkey_event(), XEvent::button, Func_t::button_release_callback, Xputty::childlist, Widget_t::childlist, childlist_find_widget(), childlist_has_child(), Childlist_t::childs, Func_t::configure_callback, Widget_t::crb, destroy_widget(), Func_t::double_click_callback, Childlist_t::elem, Widget_t::flags, Widget_t::func, HandleFiles(), HAS_FOCUS, HAS_POINTER, HAS_TOOLTIP, Metrics_t::height, HIDE_ON_DELETE, hide_tooltip(), Xputty::hold_grab, IS_POPUP, XEvent::keycode, Widget_t::metrics_min, Widget_t::mouse_inside, NO_AUTOREPEAT, onPaint(), Widget_t::pos_x, Widget_t::pos_y, quit_widget(), Xputty::run, SetClientSize(), SetMouseTracking(), show_tooltip(), Widget_t::state, Xputty::submenu, Widget_t::widget, widget_hide(), Metrics_t::width, XEvent::window, XEvent::x, and XEvent::y.

Referenced by os_create_main_window_and_surface(), and os_create_widget_window_and_surface().

Variable Documentation

◆ szMainUIClassName

TCHAR szMainUIClassName[] = TEXT("xputtyMainUI____0123456789ABCDEF")

Definition at line 34 of file xwidget-mswin.c.

Referenced by os_create_main_window_and_surface(), and os_quit().

◆ szWidgetUIClassName

TCHAR szWidgetUIClassName[] = TEXT("xputtyWidgetUI__0123456789ABCDEF")