refactor(screencopy): move code to buffer file

This commit is contained in:
Jeremy Attali 2019-12-29 02:19:42 -05:00
parent c56df33d18
commit f8494a7873
5 changed files with 12 additions and 12 deletions

View File

@ -19,6 +19,6 @@ void screencopy_frame_handle_ready(void *data,
uint32_t tv_nsec);
void screencopy_frame_handle_failed(void *data,
struct zwlr_screencopy_frame_v1 *frame);
bool screencopy_init(struct swappy_state *state);
bool buffer_init_from_screencopy(struct swappy_state *state);
void screencopy_destroy_buffer(struct swappy_buffer *buffer);
bool screencopy_parse_geometry(struct swappy_state *state);
bool buffer_parse_geometry(struct swappy_state *state);

View File

@ -44,16 +44,16 @@ executable(
swappy_resources,
files([
'src/main.c',
'src/notification.c',
'src/application.c',
'src/buffer.c',
'src/box.c',
'src/config.c',
'src/clipboard.c',
'src/file.c',
'src/paint.c',
'src/render.c',
'src/screencopy.c',
'src/notification.c',
'src/wayland.c',
'src/application.c',
]),
dependencies: [
cairo,

View File

@ -3,12 +3,12 @@
#include <gtk/gtk.h>
#include <time.h>
#include "buffer.h"
#include "clipboard.h"
#include "file.h"
#include "notification.h"
#include "paint.h"
#include "render.h"
#include "screencopy.h"
#include "swappy.h"
#include "wayland.h"
@ -548,11 +548,11 @@ static gint command_line_handler(GtkApplication *app,
GApplicationCommandLine *cmdline,
struct swappy_state *state) {
if (has_option_geometry(state)) {
if (!screencopy_parse_geometry(state)) {
if (!buffer_parse_geometry(state)) {
return EXIT_FAILURE;
}
if (!screencopy_init(state)) {
if (!buffer_init_from_screencopy(state)) {
return EXIT_FAILURE;
}
}

View File

@ -1,4 +1,4 @@
#include "screencopy.h"
#include "buffer.h"
#include <errno.h>
#include <fcntl.h>
@ -132,7 +132,7 @@ void screencopy_frame_handle_failed(void *data,
exit(EXIT_FAILURE);
}
bool screencopy_init(struct swappy_state *state) {
bool buffer_init_from_screencopy(struct swappy_state *state) {
int32_t with_cursor = 0;
size_t n_pending = 0;
struct swappy_output *output;
@ -174,7 +174,7 @@ bool screencopy_init(struct swappy_state *state) {
return true;
}
bool screencopy_parse_geometry(struct swappy_state *state) {
bool buffer_parse_geometry(struct swappy_state *state) {
struct swappy_box *geometry = g_new(struct swappy_box, 1);
char *geometry_str = state->geometry_str;
state->geometry = geometry;

View File

@ -4,7 +4,7 @@
#include <string.h>
#include <wayland-client.h>
#include "screencopy.h"
#include "buffer.h"
#include "swappy.h"
#include "wlr-screencopy-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"