mirror of
https://github.com/jtheoof/swappy.git
synced 2024-08-17 02:30:47 +03:00
refactor(screencopy): move code to buffer file
This commit is contained in:
parent
c56df33d18
commit
f8494a7873
@ -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);
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user