Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send_ConfigInfo improvements #1019

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fvwm/modconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,14 @@ void CMD_Send_ConfigInfo(F_CMD_ARGS)
*
* send_monitor_list(mod);
*/
send_desktop_geometry(mod);
/* send ImagePath and ColorLimit first */
send_image_path(mod);
send_color_limit(mod);
BroadcastDesktopConfiguration(mod);
send_colorsets(mod);
send_click_time(mod);
send_move_threshold(mod);
send_desktop_geometry(mod);
match = PeekToken(action, &action);
if (match)
{
Expand Down
63 changes: 45 additions & 18 deletions fvwm/module_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ static fqueue cqueue = FQUEUE_INIT;

static const unsigned long dummy = 0;

static void send_monitor_info(fmodule *);

static unsigned long *
make_vpacket(unsigned long *body, unsigned long event_type,
unsigned long num, va_list ap)
Expand Down Expand Up @@ -465,35 +467,60 @@ void BroadcastName(
return;
}

void BroadcastMonitorList(fmodule *this)
void BroadcastDesktopConfiguration(fmodule *send)
{
char *name;
char name[256];

snprintf(name, sizeof(name), "DesktopConfiguration %d %d",
monitor_mode, is_tracking_shared);

SendName(send, M_CONFIG_INFO, 0, 0, 0, name);
}

static
void send_monitor_info(fmodule *send)
{
struct monitor *m;
const char *m_info;
char *name;

m_info = "Monitor %s %d %d %d %d %d %d %d %d %d %d";

RB_FOREACH(m, monitors, &monitor_q) {
xasprintf(&name, m_info, m->si->name, m->flags,
m->dx, m->dy, m->virtual_scr.Vx,
m->virtual_scr.Vy, m->virtual_scr.VxMax,
m->virtual_scr.VyMax, m->virtual_scr.CurrentDesk,
monitor_get_all_widths(), monitor_get_all_heights());

SendName(send, M_CONFIG_INFO, 0, 0, 0, name);
free(name);
}
}

void BroadcastMonitorList(fmodule *this)
{
struct monitor *m;
fmodule_list_itr moditr;
fmodule *module;

module_list_itr_init(&moditr);

m_info = "Monitor %s %d %d %d %d %d %d %d %d %d %d";
if (this != NULL) {
/*
* We've been requested to send this information to a specific
* module only.
*/
send_monitor_info(this);
BroadcastDesktopConfiguration(this);
goto out;
}

while ((module = module_list_itr_next(&moditr)) != NULL) {
RB_FOREACH(m, monitors, &monitor_q) {
xasprintf(&name, m_info, m->si->name, m->flags,
m->dx, m->dy, m->virtual_scr.Vx,
m->virtual_scr.Vy, m->virtual_scr.VxMax,
m->virtual_scr.VyMax, m->virtual_scr.CurrentDesk,
monitor_get_all_widths(), monitor_get_all_heights());

SendName(module, M_CONFIG_INFO, 0, 0, 0, name);
free(name);
}
xasprintf(&name, "DesktopConfiguration %d %d",
monitor_mode, is_tracking_shared);
SendName(module, M_CONFIG_INFO, 0, 0, 0, name);
free(name);
send_monitor_info(module);
BroadcastDesktopConfiguration(module);
}

out:
/* Reissue the DesktopSize command here, rather than sending
* down the DesktopSize -- we want FvwmPager in particular to
* react to a M_NEW_PAGE event, which DesktopSize will do; and
Expand Down
1 change: 1 addition & 0 deletions fvwm/module_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void BroadcastPropertyChange(
void BroadcastColorset(int n);
void BroadcastConfigInfoString(char *string);
void BroadcastMonitorList(fmodule *);
void BroadcastDesktopConfiguration(fmodule *);
void broadcast_ignore_modifiers(void);
void SendPacket(
struct fmodule *module, unsigned long event_type,
Expand Down
Loading