Split source into multiple files
SIGUSR1 now causes reload of blacklist sigstoped now resumes all processes it stoped upon reciving SIGINT or SIGTERM sigstoped avoids stopping processes that have no top level window left TODO: is this enough?
This commit is contained in:
		
							parent
							
								
									3c7d0f49de
								
							
						
					
					
						commit
						569ce05dbb
					
				
					 8 changed files with 389 additions and 219 deletions
				
			
		
							
								
								
									
										37
									
								
								xinstance.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								xinstance.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
#include <X11/Xlib.h>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
struct Atoms
 | 
			
		||||
{
 | 
			
		||||
    Atom netActiveWindow = 0;
 | 
			
		||||
    Atom netWmPid = 0;
 | 
			
		||||
    Atom wmClientMachine = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class XInstance
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    
 | 
			
		||||
    static constexpr unsigned long MAX_BYTES = 1048576;
 | 
			
		||||
    
 | 
			
		||||
    Atoms atoms;
 | 
			
		||||
    int screen = 0;
 | 
			
		||||
    Display *display = nullptr;
 | 
			
		||||
    
 | 
			
		||||
private:
 | 
			
		||||
    
 | 
			
		||||
    unsigned long readProparty(Window wid, Atom atom, unsigned char** prop, int* format);
 | 
			
		||||
    Atom getAtom(const std::string& atomName);
 | 
			
		||||
    
 | 
			
		||||
public:
 | 
			
		||||
    
 | 
			
		||||
    ~XInstance();
 | 
			
		||||
    bool open(const std::string& xDisplayName);
 | 
			
		||||
    Window getActiveWindow();
 | 
			
		||||
    pid_t getPid(Window wid);
 | 
			
		||||
    std::vector<Window> getTopLevelWindows();
 | 
			
		||||
    void flush();
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue