Made height and width global variables, as per easier access.

This commit is contained in:
Јован Ђокић-Шумарац 2022-02-27 18:15:08 +01:00
parent b6b0441889
commit 69bc13fc71
2 changed files with 13 additions and 13 deletions

BIN
loqy

Binary file not shown.

26
main.c
View file

@ -36,16 +36,16 @@ typedef struct{unsigned long flags;
int width, height;
char pass_buffer[PASS_LEN], passwd[PASS_LEN]; char pass_buffer[PASS_LEN], passwd[PASS_LEN];
void anullate(char*, int); void anullate(char*, int);
void catch_fire(char*, int); void catch_fire(char*, int);
void draw_ui(Display*, Window, Visual*, Colormap, int, int, int); void draw_ui(Display*, Window, Visual*, Colormap, int);
void get_passwd(Display*, Window w, Visual *v, Colormap cmap, int width, int height, int screen, const char*); void get_passwd(Display*, Window, Visual*, Colormap, int, const char*);
static const char *generate_hash(void); static const char *generate_hash(void);
void window_attr(Display*, Window, int, int, int); void window_attr(Display*, Window, int);
@ -78,8 +78,8 @@ int main(void){
int s = DefaultScreen(d); int s = DefaultScreen(d);
int depth = DefaultDepth(d, s); int depth = DefaultDepth(d, s);
int width = DisplayWidth(d, s); width = DisplayWidth(d, s);
int height = DisplayHeight(d, s); height = DisplayHeight(d, s);
Window w; Window w;
@ -100,9 +100,9 @@ int main(void){
// SET WINDOW ATTRIBUTES // SET WINDOW ATTRIBUTES
window_attr(d, w, s, width, height); window_attr(d, w, s);
// DRAW THE RECTANGLES AND STRINGS // DRAW THE RECTANGLES AND STRINGS
draw_ui(d, w, visual, cmap, width, height, s); draw_ui(d, w, visual, cmap, s);
hash = generate_hash(); hash = generate_hash();
@ -121,7 +121,7 @@ int main(void){
// CHECK THE DAMNED PASSWORD // CHECK THE DAMNED PASSWORD
get_passwd(d, w, visual, cmap, width, height, s, hash); get_passwd(d, w, visual, cmap, s, hash);
XCloseDisplay(d); XCloseDisplay(d);
@ -148,7 +148,7 @@ void catch_fire(char *string, int error){
void draw_ui(Display *d, Window w, Visual *visual, Colormap cmap, int width, int height, int s){ void draw_ui(Display *d, Window w, Visual *visual, Colormap cmap, int s){
//FONT SHENANIGANS //FONT SHENANIGANS
char font_name[strlen("monospace-") +2]; char font_name[strlen("monospace-") +2];
@ -204,7 +204,7 @@ void draw_ui(Display *d, Window w, Visual *visual, Colormap cmap, int width, int
void window_attr(Display *d, Window w, int s, int width, int height){ void window_attr(Display *d, Window w, int s){
int mode_count; int mode_count;
@ -243,7 +243,7 @@ void window_attr(Display *d, Window w, int s, int width, int height){
void get_passwd(Display *d, Window w, Visual *v, Colormap cmap, int width, int height, int screen, const char *hash){ void get_passwd(Display *d, Window w, Visual *v, Colormap cmap, int screen, const char *hash){
int num, failure = 0, check = 1; int num, failure = 0, check = 1;
unsigned int len = 0; unsigned int len = 0;
@ -319,7 +319,7 @@ void get_passwd(Display *d, Window w, Visual *v, Colormap cmap, int width, int h
break; break;
} }
draw_ui(d, w, v, cmap, width, height, screen); draw_ui(d, w, v, cmap, screen);
if(!check) if(!check)
exit(0); exit(0);