This commit is contained in:
parent
39b3c035fc
commit
147124d408
5 changed files with 105 additions and 29 deletions
|
|
@ -2498,6 +2498,7 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
|||
struct xdg_toplevel_icon_v1* icon = xdg_toplevel_icon_manager_v1_create_icon(icon_manager);
|
||||
MwU64 size = pixmap->common.width * pixmap->common.height * 4;
|
||||
int i = 0;
|
||||
int line = (pixmap->common.width < pixmap->common.height) ? pixmap->common.height : pixmap->common.width;
|
||||
|
||||
if(handle->wayland.icon == NULL) {
|
||||
handle->wayland.icon = malloc(sizeof(struct _MwLLWaylandShmBuffer));
|
||||
|
|
@ -2511,7 +2512,7 @@ static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
|||
}
|
||||
handle->wayland.icon->surface = wl_compositor_create_surface(handle->wayland.compositor);
|
||||
|
||||
buffer_setup(handle->wayland.icon, pixmap->common.width, pixmap->common.height);
|
||||
buffer_setup(handle->wayland.icon, line, line);
|
||||
|
||||
wl_surface_attach(handle->wayland.icon->surface, handle->wayland.icon->shm_buffer, 0, 0);
|
||||
wl_surface_commit(handle->wayland.icon->surface);
|
||||
|
|
|
|||
|
|
@ -504,32 +504,12 @@ static void scan(MwWidget handle, const char* path, int record) {
|
|||
}
|
||||
}
|
||||
|
||||
MwWidget MwFileChooserEx(MwWidget handle, const char* title, int dir) {
|
||||
MwWidget window;
|
||||
int w, h;
|
||||
filechooser_t* fc = malloc(sizeof(*fc));
|
||||
static void setup_fallback_filechooser(MwWidget window, int dir) {
|
||||
char* path;
|
||||
MwLLPixmap icon;
|
||||
int wx;
|
||||
int wy;
|
||||
|
||||
filechooser_t* fc = malloc(sizeof(*fc));
|
||||
memset(fc, 0, sizeof(*fc));
|
||||
|
||||
w = 700;
|
||||
h = w * 2 / 3;
|
||||
|
||||
if(handle == NULL) {
|
||||
wx = wy = MwDEFAULT;
|
||||
} else {
|
||||
wx = MwGetInteger(handle, MwNx) + (MwGetInteger(handle, MwNwidth) - w) / 2;
|
||||
wy = MwGetInteger(handle, MwNy) + (MwGetInteger(handle, MwNheight) - h) / 2;
|
||||
}
|
||||
|
||||
window = MwVaCreateWidget(MwWindowClass, "filechooser", NULL, wx, wy, w, h,
|
||||
MwNtitle, title,
|
||||
NULL);
|
||||
if(handle != NULL) MwReparent(window, handle);
|
||||
|
||||
fc->history_seek = 0;
|
||||
|
||||
fc->dir = MwLoadIcon(window, MwIconDirectory);
|
||||
|
|
@ -558,8 +538,32 @@ MwWidget MwFileChooserEx(MwWidget handle, const char* title, int dir) {
|
|||
free(path);
|
||||
|
||||
MwLLBeginStateChange(window->lowlevel);
|
||||
MwLLMakePopup(window->lowlevel, handle == NULL ? NULL : handle->lowlevel);
|
||||
MwLLMakePopup(window->lowlevel, window == NULL ? NULL : window->lowlevel);
|
||||
MwLLEndStateChange(window->lowlevel);
|
||||
}
|
||||
|
||||
MwWidget MwFileChooserEx(MwWidget handle, const char* title, int dir) {
|
||||
MwWidget window;
|
||||
int w, h;
|
||||
int wx;
|
||||
int wy;
|
||||
|
||||
w = 700;
|
||||
h = w * 2 / 3;
|
||||
|
||||
if(handle == NULL) {
|
||||
wx = wy = MwDEFAULT;
|
||||
} else {
|
||||
wx = MwGetInteger(handle, MwNx) + (MwGetInteger(handle, MwNwidth) - w) / 2;
|
||||
wy = MwGetInteger(handle, MwNy) + (MwGetInteger(handle, MwNheight) - h) / 2;
|
||||
}
|
||||
|
||||
window = MwVaCreateWidget(MwWindowClass, "filechooser", NULL, wx, wy, w, h,
|
||||
MwNtitle, title,
|
||||
NULL);
|
||||
if(handle != NULL) MwReparent(window, handle);
|
||||
|
||||
setup_fallback_filechooser(window, dir);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue