Skip to content

Commit

Permalink
refactor(screencopy): move code to buffer file
Browse files Browse the repository at this point in the history
  • Loading branch information
jtheoof committed Dec 29, 2019
1 parent c56df33 commit f8494a7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/screencopy.h → include/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/application.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/screencopy.c → src/buffer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "screencopy.h"
#include "buffer.h"

#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f8494a7

Please sign in to comment.