This commit is contained in:
Nishi 2025-12-27 00:20:36 +09:00
commit cae3795044
Signed by: nishi
GPG key ID: 27EF69B208EB9343
6 changed files with 67 additions and 5 deletions

View file

@ -313,8 +313,8 @@ MwWidget wm_frame(int w, int h) {
MwAddUserHandler(f->titlebar, MwNmouseDownHandler, drag_down, NULL);
f->title = MwVaCreateWidget(MwLabelClass, "title", f->titlebar, 0, 0, 0, 0,
MwNleftPadding, 3,
NULL);
MwNleftPadding, 3,
NULL);
MwAddUserHandler(f->title, MwNmouseUpHandler, drag_up, NULL);
MwAddUserHandler(f->title, MwNmouseMoveHandler, drag, NULL);
MwAddUserHandler(f->title, MwNmouseDownHandler, drag_down, NULL);

View file

@ -320,7 +320,7 @@ static void set_name(Window wnd) {
unsigned long nitem, after;
unsigned char* buf = NULL;
Atom atom = XInternAtom(xdisplay, "WM_NAME", False);
Atom utf8 = XInternAtom(xdisplay, "UTF8_STRING", False);
Atom utf8 = XInternAtom(xdisplay, "UTF8_STRING", False);
int i;
for(i = 0; i < arrlen(windows); i++) {

View file

@ -20,6 +20,7 @@ add_subdirectory(separator)
add_subdirectory(startbutton)
add_subdirectory(time)
add_subdirectory(taskbar)
add_subdirectory(launcher)
include(GNUInstallDirs)
configure_file(mpanelrc.in mpanelrc)

View file

@ -0,0 +1,9 @@
include(MDEBase)
include(MDEPkgConfig)
mde_setup_library(LauncherModule ${CMAKE_INSTALL_LIBDIR}/mpanel)
target_link_libraries(
LauncherModule
PRIVATE
xemil
)

43
mpanel/launcher/module.c Normal file
View file

@ -0,0 +1,43 @@
#include <Mw/Milsko.h>
#include <xemil.h>
void module(MwWidget box, xl_node_t* node) {
MwWidget f;
xl_node_t* n;
int c;
int w;
int gap = (MwGetInteger(box, MwNheight) - 18 * 2);
c = 0;
n = node->first_child;
while(n != NULL) {
if(n->type == XL_NODE_NODE && strcmp(n->name, "Execute") == 0 && n->text != NULL) {
c++;
}
n = n->next;
}
w = (c + (c % 2)) / 2;
f = MwVaCreateWidget(MwFrameClass, "launcher", box, 0, 0, 0, 0,
MwNfixedSize, (gap + 18) * w - gap,
NULL);
c = 0;
n = node->first_child;
while(n != NULL) {
int x = (gap + 18) * (c / 2);
int y = (gap + 18) * (c % 2);
if(n->type == XL_NODE_NODE && strcmp(n->name, "Execute") == 0 && n->text != NULL) {
MwWidget btn = MwVaCreateWidget(MwButtonClass, "button", f, x, y, 18, 18,
MwNflat, 1,
NULL);
c++;
}
n = n->next;
}
}

View file

@ -8,11 +8,20 @@
<Menu>
<Application Name="Applications" />
<Separator />
<Execute Name="Terminal">xterm</Execute>
<Execute Name=""></Execute>
<Execute Name="Terminal">uxterm</Execute>
</Menu>
</StartButton>
<Separator />
<Launcher>
<Execute>uxterm</Execute>
<Execute>uxterm</Execute>
<Execute>uxterm</Execute>
<Execute>uxterm</Execute>
<Execute>uxterm</Execute>
</Launcher>
<Separator />
<TaskBar>