Port BSPWM to gcc10

GCC10 enables -fno-common by default.
This patch allows building BSPWM with -fno-common enabled.

Fixes #1119.
This commit is contained in:
Emanuele Torre 2020-05-27 03:18:10 +02:00 committed by Bastien Dejean
parent eca4fbeb76
commit 6c39ab0823
10 changed files with 175 additions and 80 deletions

View file

@ -51,6 +51,44 @@
#include "query.h" #include "query.h"
#include "bspwm.h" #include "bspwm.h"
xcb_connection_t *dpy;
int default_screen, screen_width, screen_height;
uint32_t clients_count;
xcb_screen_t *screen;
xcb_window_t root;
char config_path[MAXLEN];
monitor_t *mon;
monitor_t *mon_head;
monitor_t *mon_tail;
monitor_t *pri_mon;
history_t *history_head;
history_t *history_tail;
history_t *history_needle;
rule_t *rule_head;
rule_t *rule_tail;
stacking_list_t *stack_head;
stacking_list_t *stack_tail;
subscriber_list_t *subscribe_head;
subscriber_list_t *subscribe_tail;
pending_rule_t *pending_rule_head;
pending_rule_t *pending_rule_tail;
xcb_window_t meta_window;
motion_recorder_t motion_recorder;
xcb_atom_t WM_STATE;
xcb_atom_t WM_TAKE_FOCUS;
xcb_atom_t WM_DELETE_WINDOW;
int exit_status;
bool auto_raise;
bool sticky_still;
bool hide_sticky;
bool record_history;
bool running;
bool restart;
bool randr;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
fd_set descriptors; fd_set descriptors;

View file

@ -44,47 +44,49 @@
#define MOTION_RECORDER_I "motion_recorder" #define MOTION_RECORDER_I "motion_recorder"
#define MOTION_RECORDER_IC MOTION_RECORDER_I "\0" BSPWM_CLASS_NAME #define MOTION_RECORDER_IC MOTION_RECORDER_I "\0" BSPWM_CLASS_NAME
xcb_connection_t *dpy; typedef struct {
int default_screen, screen_width, screen_height;
uint32_t clients_count;
xcb_screen_t *screen;
xcb_window_t root;
char config_path[MAXLEN];
monitor_t *mon;
monitor_t *mon_head;
monitor_t *mon_tail;
monitor_t *pri_mon;
history_t *history_head;
history_t *history_tail;
history_t *history_needle;
rule_t *rule_head;
rule_t *rule_tail;
stacking_list_t *stack_head;
stacking_list_t *stack_tail;
subscriber_list_t *subscribe_head;
subscriber_list_t *subscribe_tail;
pending_rule_t *pending_rule_head;
pending_rule_t *pending_rule_tail;
xcb_window_t meta_window;
struct {
xcb_window_t id; xcb_window_t id;
uint16_t sequence; uint16_t sequence;
bool enabled; bool enabled;
} motion_recorder; } motion_recorder_t;
xcb_atom_t WM_STATE;
xcb_atom_t WM_TAKE_FOCUS;
xcb_atom_t WM_DELETE_WINDOW;
int exit_status;
bool auto_raise; extern xcb_connection_t *dpy;
bool sticky_still; extern int default_screen, screen_width, screen_height;
bool hide_sticky; extern uint32_t clients_count;
bool record_history; extern xcb_screen_t *screen;
bool running; extern xcb_window_t root;
bool restart; extern char config_path[MAXLEN];
bool randr;
extern monitor_t *mon;
extern monitor_t *mon_head;
extern monitor_t *mon_tail;
extern monitor_t *pri_mon;
extern history_t *history_head;
extern history_t *history_tail;
extern history_t *history_needle;
extern rule_t *rule_head;
extern rule_t *rule_tail;
extern stacking_list_t *stack_head;
extern stacking_list_t *stack_tail;
extern subscriber_list_t *subscribe_head;
extern subscriber_list_t *subscribe_tail;
extern pending_rule_t *pending_rule_head;
extern pending_rule_t *pending_rule_tail;
extern xcb_window_t meta_window;
extern motion_recorder_t motion_recorder;
extern xcb_atom_t WM_STATE;
extern xcb_atom_t WM_TAKE_FOCUS;
extern xcb_atom_t WM_DELETE_WINDOW;
extern int exit_status;
extern bool auto_raise;
extern bool sticky_still;
extern bool hide_sticky;
extern bool record_history;
extern bool running;
extern bool restart;
extern bool randr;
void init(void); void init(void);
void setup(void); void setup(void);

View file

@ -35,6 +35,8 @@
#include "rule.h" #include "rule.h"
#include "events.h" #include "events.h"
uint8_t randr_base;
void handle_event(xcb_generic_event_t *evt) void handle_event(xcb_generic_event_t *evt)
{ {
uint8_t resp_type = XCB_EVENT_RESPONSE_TYPE(evt); uint8_t resp_type = XCB_EVENT_RESPONSE_TYPE(evt);

View file

@ -30,7 +30,7 @@
#define ERROR_CODE_BAD_WINDOW 3 #define ERROR_CODE_BAD_WINDOW 3
uint8_t randr_base; extern uint8_t randr_base;
static const xcb_button_index_t BUTTONS[] = {XCB_BUTTON_INDEX_1, XCB_BUTTON_INDEX_2, XCB_BUTTON_INDEX_3}; static const xcb_button_index_t BUTTONS[] = {XCB_BUTTON_INDEX_1, XCB_BUTTON_INDEX_2, XCB_BUTTON_INDEX_3};
void handle_event(xcb_generic_event_t *evt); void handle_event(xcb_generic_event_t *evt);

View file

@ -31,6 +31,8 @@
#include "tree.h" #include "tree.h"
#include "ewmh.h" #include "ewmh.h"
xcb_ewmh_connection_t *ewmh;
void ewmh_init(void) void ewmh_init(void)
{ {
ewmh = calloc(1, sizeof(xcb_ewmh_connection_t)); ewmh = calloc(1, sizeof(xcb_ewmh_connection_t));

View file

@ -27,7 +27,7 @@
#include <xcb/xcb_ewmh.h> #include <xcb/xcb_ewmh.h>
xcb_ewmh_connection_t *ewmh; extern xcb_ewmh_connection_t *ewmh;
void ewmh_init(void); void ewmh_init(void);
void ewmh_update_active_window(void); void ewmh_update_active_window(void);

View file

@ -36,6 +36,13 @@
#include "window.h" #include "window.h"
#include "pointer.h" #include "pointer.h"
uint16_t num_lock;
uint16_t caps_lock;
uint16_t scroll_lock;
bool grabbing;
node_t *grabbed_node;
void pointer_init(void) void pointer_init(void)
{ {
num_lock = modfield_from_keysym(XK_Num_Lock); num_lock = modfield_from_keysym(XK_Num_Lock);

View file

@ -29,12 +29,12 @@
#define XK_Caps_Lock 0xffe5 #define XK_Caps_Lock 0xffe5
#define XK_Scroll_Lock 0xff14 #define XK_Scroll_Lock 0xff14
uint16_t num_lock; extern uint16_t num_lock;
uint16_t caps_lock; extern uint16_t caps_lock;
uint16_t scroll_lock; extern uint16_t scroll_lock;
bool grabbing; extern bool grabbing;
node_t *grabbed_node; extern node_t *grabbed_node;
void pointer_init(void); void pointer_init(void);
void window_grab_buttons(xcb_window_t win); void window_grab_buttons(xcb_window_t win);

View file

@ -30,6 +30,50 @@
extern char **environ; extern char **environ;
char external_rules_command[MAXLEN];
char status_prefix[MAXLEN];
char normal_border_color[MAXLEN];
char active_border_color[MAXLEN];
char focused_border_color[MAXLEN];
char presel_feedback_color[MAXLEN];
padding_t padding;
padding_t monocle_padding;
int window_gap;
unsigned int border_width;
double split_ratio;
child_polarity_t initial_polarity;
automatic_scheme_t automatic_scheme;
bool removal_adjustment;
tightness_t directional_focus_tightness;
uint16_t pointer_modifier;
uint32_t pointer_motion_interval;
pointer_action_t pointer_actions[3];
int8_t mapping_events_count;
bool presel_feedback;
bool borderless_monocle;
bool gapless_monocle;
bool single_monocle;
bool focus_follows_pointer;
bool pointer_follows_focus;
bool pointer_follows_monitor;
int8_t click_to_focus;
bool swallow_first_click;
bool ignore_ewmh_focus;
bool ignore_ewmh_struts;
state_transition_t ignore_ewmh_fullscreen;
bool center_pseudo_tiled;
bool honor_size_hints;
bool remove_disabled_monitors;
bool remove_unplugged_monitors;
bool merge_overlapping_monitors;
void run_config(void) void run_config(void)
{ {
if (fork() == 0) { if (fork() == 0) {

View file

@ -67,49 +67,49 @@
#define REMOVE_UNPLUGGED_MONITORS false #define REMOVE_UNPLUGGED_MONITORS false
#define MERGE_OVERLAPPING_MONITORS false #define MERGE_OVERLAPPING_MONITORS false
char external_rules_command[MAXLEN]; extern char external_rules_command[MAXLEN];
char status_prefix[MAXLEN]; extern char status_prefix[MAXLEN];
char normal_border_color[MAXLEN]; extern char normal_border_color[MAXLEN];
char active_border_color[MAXLEN]; extern char active_border_color[MAXLEN];
char focused_border_color[MAXLEN]; extern char focused_border_color[MAXLEN];
char presel_feedback_color[MAXLEN]; extern char presel_feedback_color[MAXLEN];
padding_t padding; extern padding_t padding;
padding_t monocle_padding; extern padding_t monocle_padding;
int window_gap; extern int window_gap;
unsigned int border_width; extern unsigned int border_width;
double split_ratio; extern double split_ratio;
child_polarity_t initial_polarity; extern child_polarity_t initial_polarity;
automatic_scheme_t automatic_scheme; extern automatic_scheme_t automatic_scheme;
bool removal_adjustment; extern bool removal_adjustment;
tightness_t directional_focus_tightness; extern tightness_t directional_focus_tightness;
uint16_t pointer_modifier; extern uint16_t pointer_modifier;
uint32_t pointer_motion_interval; extern uint32_t pointer_motion_interval;
pointer_action_t pointer_actions[3]; extern pointer_action_t pointer_actions[3];
int8_t mapping_events_count; extern int8_t mapping_events_count;
bool presel_feedback; extern bool presel_feedback;
bool borderless_monocle; extern bool borderless_monocle;
bool gapless_monocle; extern bool gapless_monocle;
bool single_monocle; extern bool single_monocle;
bool focus_follows_pointer; extern bool focus_follows_pointer;
bool pointer_follows_focus; extern bool pointer_follows_focus;
bool pointer_follows_monitor; extern bool pointer_follows_monitor;
int8_t click_to_focus; extern int8_t click_to_focus;
bool swallow_first_click; extern bool swallow_first_click;
bool ignore_ewmh_focus; extern bool ignore_ewmh_focus;
bool ignore_ewmh_struts; extern bool ignore_ewmh_struts;
state_transition_t ignore_ewmh_fullscreen; extern state_transition_t ignore_ewmh_fullscreen;
bool center_pseudo_tiled; extern bool center_pseudo_tiled;
bool honor_size_hints; extern bool honor_size_hints;
bool remove_disabled_monitors; extern bool remove_disabled_monitors;
bool remove_unplugged_monitors; extern bool remove_unplugged_monitors;
bool merge_overlapping_monitors; extern bool merge_overlapping_monitors;
void run_config(void); void run_config(void);
void load_settings(void); void load_settings(void);