imlib.c (scrot-0.8) | : | imlib.c (scrot-1.6.tar.bz2) | ||
---|---|---|---|---|
/* imlib.c | /* imlib.c | |||
Copyright (C) 1999,2000 Tom Gilbert. | Copyright 1999-2000 Tom Gilbert | |||
Copyright 2020 Daniel T. Borelli <daltomi@disroot.org> | ||||
Copyright 2020 ideal <idealities@gmail.com> | ||||
Copyright 2020 Sean Brennan <zettix1@gmail.com> | ||||
Copyright 2021 Christopher R. Nelson <christopher.nelson@languidnights.com> | ||||
Permission is hereby granted, free of charge, to any person obtaining a copy | Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to | of this software and associated documentation files (the "Software"), to | |||
deal in the Software without restriction, including without limitation the | deal in the Software without restriction, including without limitation the | |||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
sell copies of the Software, and to permit persons to whom the Software is | sell copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in | The above copyright notice and this permission notice shall be included in | |||
all copies of the Software and its documentation and acknowledgment shall be | all copies of the Software and its documentation and acknowledgment shall be | |||
skipping to change at line 40 | skipping to change at line 44 | |||
Visual *vis = NULL; | Visual *vis = NULL; | |||
Screen *scr = NULL; | Screen *scr = NULL; | |||
Colormap cm; | Colormap cm; | |||
int depth; | int depth; | |||
Window root = 0; | Window root = 0; | |||
void | void | |||
init_x_and_imlib(char *dispstr, int screen_num) | init_x_and_imlib(char *dispstr, int screen_num) | |||
{ | { | |||
disp = XOpenDisplay(dispstr); | disp = XOpenDisplay(dispstr); | |||
if (!disp) | if (!disp) { | |||
gib_eprintf("Can't open X display. It *is* running, yeah?"); | fprintf(stderr, "Can't open X display. It *is* running, yeah? ["); | |||
fprintf(stderr, "%s", dispstr ? dispstr : | ||||
(getenv("DISPLAY") ? getenv("DISPLAY") : "NULL")); | ||||
fprintf(stderr, "]\n"); | ||||
exit(EXIT_FAILURE); | ||||
} | ||||
if (screen_num) | if (screen_num) | |||
scr = ScreenOfDisplay(disp, screen_num); | scr = ScreenOfDisplay(disp, screen_num); | |||
else | else | |||
scr = ScreenOfDisplay(disp, DefaultScreen(disp)); | scr = ScreenOfDisplay(disp, DefaultScreen(disp)); | |||
vis = DefaultVisual(disp, XScreenNumberOfScreen(scr)); | vis = DefaultVisual(disp, XScreenNumberOfScreen(scr)); | |||
depth = DefaultDepth(disp, XScreenNumberOfScreen(scr)); | depth = DefaultDepth(disp, XScreenNumberOfScreen(scr)); | |||
cm = DefaultColormap(disp, XScreenNumberOfScreen(scr)); | cm = DefaultColormap(disp, XScreenNumberOfScreen(scr)); | |||
root = RootWindow(disp, XScreenNumberOfScreen(scr)); | root = RootWindow(disp, XScreenNumberOfScreen(scr)); | |||
imlib_context_set_drawable(root); | ||||
imlib_context_set_display(disp); | imlib_context_set_display(disp); | |||
imlib_context_set_visual(vis); | imlib_context_set_visual(vis); | |||
imlib_context_set_colormap(cm); | imlib_context_set_colormap(cm); | |||
imlib_context_set_color_modifier(NULL); | imlib_context_set_color_modifier(NULL); | |||
imlib_context_set_operation(IMLIB_OP_COPY); | imlib_context_set_operation(IMLIB_OP_COPY); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 14 lines changed or added |