mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-09 10:53:27 +00:00
add new function
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@188 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -81,6 +81,7 @@ MWDECL void MwLLForceRender(MwLL handle);
|
||||
|
||||
MWDECL void MwLLSetCursor(MwLL handle, MwCursor* image, MwCursor* mask);
|
||||
MWDECL void MwLLDetach(MwLL handle, MwPoint* point);
|
||||
MWDECL void MwLLShow(MwLL handle, int show);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -389,3 +389,8 @@ void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||
|
||||
SetWindowLongPtr(handle->hWnd, GWL_STYLE, style);
|
||||
}
|
||||
|
||||
void MwLLShow(MwLL handle, int show) {
|
||||
ShowWindow(handle->hWnd, show ? SW_NORMAL : SW_HIDE);
|
||||
if(show) SetFocus(handle->hWnd);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,13 @@ void MwLLDetach(MwLL handle, MwPoint* point) {
|
||||
XTranslateCoordinates(handle->display, parent, RootWindow(handle->display, DefaultScreen(handle->display)), 0, 0, &x, &y, &child);
|
||||
|
||||
XReparentWindow(handle->display, handle->window, RootWindow(handle->display, DefaultScreen(handle->display)), x + point->x, y + point->y);
|
||||
|
||||
XMapWindow(handle->display, handle->window);
|
||||
// XSetInputFocus(handle->display, handle->window, RevertToNone, CurrentTime);
|
||||
}
|
||||
|
||||
void MwLLShow(MwLL handle, int show) {
|
||||
if(show) {
|
||||
XMapWindow(handle->display, handle->window);
|
||||
XSetInputFocus(handle->display, handle->window, RevertToNone, CurrentTime);
|
||||
} else {
|
||||
XUnmapWindow(handle->display, handle->window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,7 @@
|
||||
#include "../external/stb_ds.h"
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
/* todo: we should have a public "show" function here that is implemented per
|
||||
platform, as opposed to just shoving it here. perchance. */
|
||||
#ifdef _WIN32
|
||||
ShowWindow(handle->lowlevel->hWnd, SW_HIDE);
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
XUnmapWindow(handle->lowlevel->display, handle->lowlevel->window);
|
||||
#endif
|
||||
MwLLShow(handle->lowlevel, 0);
|
||||
|
||||
MwSetDefault(handle);
|
||||
|
||||
@@ -181,15 +174,14 @@ void MwSubMenuAppear(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
handle->internal = menu;
|
||||
|
||||
MwLLDetach(handle->lowlevel, point);
|
||||
|
||||
#ifdef _WIN32
|
||||
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_STYLE, (LONG_PTR)0);
|
||||
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_EXSTYLE, (LONG_PTR)WS_EX_TOOLWINDOW);
|
||||
|
||||
ShowWindow(handle->lowlevel->hWnd, SW_NORMAL);
|
||||
|
||||
SetFocus(handle->lowlevel->hWnd);
|
||||
#endif
|
||||
|
||||
MwLLShow(handle->lowlevel, 1);
|
||||
|
||||
for(i = 0; i < arrlen(menu->sub); i++) {
|
||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||
h += MwTextHeight(handle, menu->sub[i]->name) + 3;
|
||||
|
||||
Reference in New Issue
Block a user