mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	fix: crash in minimize handle when kill some special app
This commit is contained in:
		
							parent
							
								
									739883dd3a
								
							
						
					
					
						commit
						397a4c2435
					
				
					 1 changed files with 47 additions and 42 deletions
				
			
		
							
								
								
									
										65
									
								
								main.c
									
										
									
									
									
								
							
							
						
						
									
										65
									
								
								main.c
									
										
									
									
									
								
							| 
						 | 
					@ -2389,39 +2389,17 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
 | 
				
			||||||
  focused = focustop(monitor);
 | 
					  focused = focustop(monitor);
 | 
				
			||||||
  zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
 | 
					  zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ((monitor->tagset[monitor->seltags] & TAGMASK) == TAGMASK) {
 | 
					  // if ((monitor->tagset[monitor->seltags] & TAGMASK) == TAGMASK) {
 | 
				
			||||||
    state = 0;
 | 
					  //   state = 0;
 | 
				
			||||||
    state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
					  //   state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
				
			||||||
    zdwl_ipc_output_v2_send_tag(ipc_output->resource, 888, state, 1, 1);
 | 
					  //   zdwl_ipc_output_v2_send_tag(ipc_output->resource, 888, state, 1, 1);
 | 
				
			||||||
  } else {
 | 
					  // } else {
 | 
				
			||||||
    for (tag = 0; tag < LENGTH(tags); tag++) {
 | 
					 | 
				
			||||||
      numclients = state = focused_client = 0;
 | 
					 | 
				
			||||||
      tagmask = 1 << tag;
 | 
					 | 
				
			||||||
      if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
 | 
					 | 
				
			||||||
        state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      wl_list_for_each(c, &clients, link) {
 | 
					 | 
				
			||||||
        if (c->mon != monitor)
 | 
					 | 
				
			||||||
          continue;
 | 
					 | 
				
			||||||
        if (!(c->tags & tagmask))
 | 
					 | 
				
			||||||
          continue;
 | 
					 | 
				
			||||||
        if (c == focused)
 | 
					 | 
				
			||||||
          focused_client = 1;
 | 
					 | 
				
			||||||
        if (c->isurgent)
 | 
					 | 
				
			||||||
          state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        numclients++;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state, numclients,
 | 
					 | 
				
			||||||
                                  focused_client);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //   for (tag = 0; tag < LENGTH(tags); tag++) {
 | 
					  //   for (tag = 0; tag < LENGTH(tags); tag++) {
 | 
				
			||||||
  //     numclients = state = focused_client = 0;
 | 
					  //     numclients = state = focused_client = 0;
 | 
				
			||||||
  //     tagmask = 1 << tag;
 | 
					  //     tagmask = 1 << tag;
 | 
				
			||||||
  //     if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
 | 
					  //     if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
 | 
				
			||||||
  //       state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
					  //       state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //     wl_list_for_each(c, &clients, link) {
 | 
					  //     wl_list_for_each(c, &clients, link) {
 | 
				
			||||||
  //       if (c->mon != monitor)
 | 
					  //       if (c->mon != monitor)
 | 
				
			||||||
  //         continue;
 | 
					  //         continue;
 | 
				
			||||||
| 
						 | 
					@ -2431,11 +2409,33 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
 | 
				
			||||||
  //         focused_client = 1;
 | 
					  //         focused_client = 1;
 | 
				
			||||||
  //       if (c->isurgent)
 | 
					  //       if (c->isurgent)
 | 
				
			||||||
  //         state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
 | 
					  //         state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //       numclients++;
 | 
					  //       numclients++;
 | 
				
			||||||
  //     }
 | 
					  //     }
 | 
				
			||||||
  //     zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state,
 | 
					  //     zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state, numclients,
 | 
				
			||||||
  //     numclients, focused_client);
 | 
					  //                                 focused_client);
 | 
				
			||||||
  //   }
 | 
					  //   }
 | 
				
			||||||
 | 
					  // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for ( tag = 0 ; tag < LENGTH(tags); tag++) {
 | 
				
			||||||
 | 
					      numclients = state = focused_client = 0;
 | 
				
			||||||
 | 
					      tagmask = 1 << tag;
 | 
				
			||||||
 | 
					      if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
 | 
				
			||||||
 | 
					          state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
 | 
				
			||||||
 | 
					      wl_list_for_each(c, &clients, link) {
 | 
				
			||||||
 | 
					          if (c->mon != monitor)
 | 
				
			||||||
 | 
					              continue;
 | 
				
			||||||
 | 
					          if (!(c->tags & tagmask))
 | 
				
			||||||
 | 
					              continue;
 | 
				
			||||||
 | 
					          if (c == focused)
 | 
				
			||||||
 | 
					              focused_client = 1;
 | 
				
			||||||
 | 
					          if (c->isurgent)
 | 
				
			||||||
 | 
					              state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
 | 
				
			||||||
 | 
					          numclients++;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state,
 | 
				
			||||||
 | 
					      numclients, focused_client);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  title = focused ? client_get_title(focused) : "";
 | 
					  title = focused ? client_get_title(focused) : "";
 | 
				
			||||||
  appid = focused ? client_get_appid(focused) : "";
 | 
					  appid = focused ? client_get_appid(focused) : "";
 | 
				
			||||||
| 
						 | 
					@ -3078,6 +3078,10 @@ maximizenotify(struct wl_listener *listener, void *data) {
 | 
				
			||||||
  // 	wlr_xdg_surface_schedule_configure(c->surface.xdg);
 | 
					  // 	wlr_xdg_surface_schedule_configure(c->surface.xdg);
 | 
				
			||||||
  // togglefakefullscreen(&(Arg){0});
 | 
					  // togglefakefullscreen(&(Arg){0});
 | 
				
			||||||
  Client *c = wl_container_of(listener, c, maximize);
 | 
					  Client *c = wl_container_of(listener, c, maximize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(!c || !c->mon || c->iskilling)
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (c->isfakefullscreen || c->isfullscreen)
 | 
					  if (c->isfakefullscreen || c->isfullscreen)
 | 
				
			||||||
    setfakefullscreen(c, 0);
 | 
					    setfakefullscreen(c, 0);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
| 
						 | 
					@ -3119,6 +3123,7 @@ minimizenotify(struct wl_listener *listener, void *data) {
 | 
				
			||||||
  // 	wlr_xdg_surface_schedule_configure(c->surface.xdg);
 | 
					  // 	wlr_xdg_surface_schedule_configure(c->surface.xdg);
 | 
				
			||||||
  // togglefakefullscreen(&(Arg){0});
 | 
					  // togglefakefullscreen(&(Arg){0});
 | 
				
			||||||
  Client *c = wl_container_of(listener, c, minimize);
 | 
					  Client *c = wl_container_of(listener, c, minimize);
 | 
				
			||||||
 | 
					  if(c && c->mon && !c->iskilling)
 | 
				
			||||||
    set_minized(c);
 | 
					    set_minized(c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue