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

if monitor name happens to get updated in ParseOptions, the rest of FvwmPager config is skipped #146

Merged
merged 6 commits into from
Jun 30, 2020

Conversation

d-e-e-p
Copy link
Contributor

@d-e-e-p d-e-e-p commented Jun 28, 2020

might be useful to have a helper function update monitor params from string, eg:

void extract_monitor_config(struct fpmonitor *m, char *tline) {               
    int  output, mdw, mdh, vx, vy, vxmax, vymax, iscur;                       
    int  x, y, w, h;                                                          
                                                                              
    sscanf(tline, "%d %d %d %d %d %d %d %d %d %d %d %d",                      
        &output, &iscur, &mdw, &mdh, &vx, &vy, &vxmax, &vymax,                
        &x, &y, &w, &h);                                                      
    m->x = x;                                                                 
    m->y = y;                                                                 
    m->w = w;                                                                 
    m->h = h;                                                                 
    m->output = output;                                                       
    m->is_current = iscur;                                                    
    m->virtual_scr.MyDisplayWidth = mdw;                                      
    m->virtual_scr.MyDisplayHeight = mdh;                                     
    m->virtual_scr.Vx = vx;                                                   
    m->virtual_scr.Vy = vy;                                                   
    m->virtual_scr.VxMax = vxmax;                                             
    m->virtual_scr.VyMax = vymax;                                             
                                                                              
}  

@ThomasAdam
Copy link
Member

ThomasAdam commented Jun 28, 2020

Hi @d-e-e-p,

If you wanted to incorporate that suggestion, please do.

This would mean using this function in two places:

  • list_config_info()
  • ParseOptions()

@ThomasAdam ThomasAdam self-assigned this Jun 28, 2020
@ThomasAdam ThomasAdam added the type:bug Something's broken! label Jun 28, 2020
Copy link
Member

@ThomasAdam ThomasAdam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @d-e-e-p,

Excellent. Thanks for this. Functionally this all looks good. Just some minor style nits inline, with a couple of suggestions you can approve as you're reading.

@@ -1467,6 +1467,28 @@ void list_end(void)
XFree((char *)children);
}

void extract_monitor_config(struct fpmonitor *m, char *tline) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void extract_monitor_config(struct fpmonitor *m, char *tline) {
void extract_monitor_config(struct fpmonitor *m, char *tline)
{

m2->virtual_scr.Vy = vy;
m2->virtual_scr.VxMax = vxmax;
m2->virtual_scr.VyMax = vymax;
extract_monitor_config(m2,tline);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indenting here looks odd.

m->virtual_scr.Vy = vy;
m->virtual_scr.VxMax = vxmax;
m->virtual_scr.VyMax = vymax;
extract_monitor_config(m,tline);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here -- indentation looks odd. Also:

Suggested change
extract_monitor_config(m,tline);
extract_monitor_config(m, tline);

TAILQ_INSERT_TAIL(&fp_monitor_q, m, entry);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blank line necessary here:

Suggested change

m2->virtual_scr.Vy = vy;
m2->virtual_scr.VxMax = vxmax;
m2->virtual_scr.VyMax = vymax;
extract_monitor_config(m2,next);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, indentation seems off. Also:

Suggested change
extract_monitor_config(m2,next);
extract_monitor_config(m2, next);

m->virtual_scr.Vy = vy;
m->virtual_scr.VxMax = vxmax;
m->virtual_scr.VyMax = vymax;
extract_monitor_config(m,next);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

@@ -169,6 +169,7 @@ RETSIGTYPE DeadPipe(int nonsense);
void process_message(FvwmPacket*);
void ParseOptions(void);

void extract_monitor_config(struct fpmonitor *m, char *tline);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a mess of styles, but for new additions:

  • Scoped functions should be declared as static;
  • Function prototypes can be unnamed with respect to the variables used.

Hence:

Suggested change
void extract_monitor_config(struct fpmonitor *m, char *tline);
static void extract_monitor_config(struct fpmonitor *, char *);

@d-e-e-p
Copy link
Contributor Author

d-e-e-p commented Jun 29, 2020

check in with changes..thanks for walking me thru all of them.

@ThomasAdam
Copy link
Member

Hi @d-e-e-p,

OK. Thanks! Please can you squash the last two commits together and push the changes here?

Thanks,
Thomas

…onfig file is skipped.

also added helper function extract_monitor_config to extract monitor params from string
@ThomasAdam ThomasAdam merged commit 086e1ac into fvwmorg:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something's broken!
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants