- 
                Notifications
    You must be signed in to change notification settings 
- Fork 434
Add fullscreen bypass support #808
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
          
     Open
      
      
            aedalzotto
  wants to merge
  8
  commits into
  jonls:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
aedalzotto:fullscreen
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 6 commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      7986457
              
                Add support for fullscreen bypass
              
              
                aedalzotto c0bf003
              
                Allow to disable fullscreen bypass with "-f 0"
              
              
                aedalzotto bcb3323
              
                Ready signals for fullscreen bypass disable from front-end
              
              
                aedalzotto 09e08a4
              
                Remove libX11 from optionals to reflect fullscreen bypass changes
              
              
                aedalzotto 92fb008
              
                Guard X11 specific values from Windows
              
              
                aedalzotto 84680da
              
                Add src/fullscreen.c to POTFILES.in
              
              
                aedalzotto d52d93f
              
                Add 'Fullscreen bypass' toggle to redshift-gtk
              
              
                aedalzotto 5a0a09c
              
                Check geometry based on root window to support display hotplug
              
              
                aedalzotto File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* fullscreen.h -- Fullscreen detector | ||
| This file is part of Redshift. | ||
|  | ||
| Redshift is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|  | ||
| Redshift is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|  | ||
| You should have received a copy of the GNU General Public License | ||
| along with Redshift. If not, see <http://www.gnu.org/licenses/>. | ||
|  | ||
| Copyright (c) 2021 Angelo Elias Dalzotto <[email protected]> | ||
| */ | ||
|  | ||
| #ifdef HAVE_CONFIG_H | ||
| # include "config.h" | ||
| #endif | ||
|  | ||
| #include <stdlib.h> | ||
| #include <stdio.h> | ||
| #include <stdint.h> | ||
| #include <string.h> | ||
|  | ||
| #ifdef ENABLE_NLS | ||
| # include <libintl.h> | ||
| # define _(s) gettext(s) | ||
| #else | ||
| # define _(s) s | ||
| #endif | ||
|  | ||
| #ifndef _WIN32 | ||
| # include <X11/Xlib.h> | ||
| #endif | ||
|  | ||
| #include "fullscreen.h" | ||
| #include "redshift.h" | ||
|  | ||
| #ifndef _WIN32 | ||
| static Display *display; | ||
| static int screen_width, screen_height; | ||
| #endif | ||
|  | ||
| static int | ||
| fullscreen_init() | ||
| { | ||
| #ifndef _WIN32 | ||
| screen_height = -1; | ||
| screen_width = -1; | ||
| display = XOpenDisplay(NULL); | ||
| if (display == NULL) { | ||
| fprintf(stderr, _("X request failed: %s\n"), "XOpenDisplay"); | ||
| return -1; | ||
| } | ||
|  | ||
| int screen = DefaultScreen(display); | ||
| screen_width = DisplayWidth(display, screen); | ||
| screen_height = DisplayHeight(display, screen); | ||
| #endif | ||
|  | ||
| return 0; | ||
| } | ||
|  | ||
| static int | ||
| fullscreen_check() | ||
| { | ||
| #ifndef _WIN32 | ||
| Window window; | ||
| int revert_to = RevertToParent; | ||
| int result = XGetInputFocus(display, &window, &revert_to); | ||
|  | ||
| int win_x, win_y, win_w, win_h, win_b, win_d; | ||
| if(result) { | ||
| Window rootWindow; | ||
| result = XGetGeometry(display, window, &rootWindow, &win_x, &win_y, &win_w, &win_h, &win_b, &win_d); | ||
| } | ||
|  | ||
| if (result && win_w == screen_width && win_h == screen_height) { | ||
| return 1; | ||
| } else { | ||
| #endif | ||
| return 0; | ||
| #ifndef _WIN32 | ||
| } | ||
| #endif | ||
| } | ||
|  | ||
| const fullscreen_t fullscreen = { | ||
| "fullscreen", | ||
| (fullscreen_init_func *)fullscreen_init, | ||
| (fullscreen_check_func *)fullscreen_check, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* fullscreen.h -- Fullscreen detector header | ||
| This file is part of Redshift. | ||
|  | ||
| Redshift is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|  | ||
| Redshift is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|  | ||
| You should have received a copy of the GNU General Public License | ||
| along with Redshift. If not, see <http://www.gnu.org/licenses/>. | ||
|  | ||
| Copyright (c) 2021 Angelo Elias Dalzotto <[email protected]> | ||
| */ | ||
|  | ||
| #ifndef REDSHIFT_FULLSCREEN_H | ||
| #define REDSHIFT_FULLSCREEN_H | ||
|  | ||
| #include "redshift.h" | ||
|  | ||
| extern const fullscreen_t fullscreen; | ||
|  | ||
| #endif /* ! REDSHIFT_FULLSCREEN_H */ | ||
|  | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redshift is in sore need of a control interface other than signals.