log more about screencast

This commit is contained in:
vaxerski 2022-12-05 22:50:19 +00:00
parent 4ac6a9af82
commit 2a634b0a60

View file

@ -528,6 +528,8 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
strcat(cmd, XCURSOR_SIZE ? XCURSOR_SIZE : "24");
strcat(cmd, " QT_QPA_PLATFORM=wayland hyprland-share-picker");
logprint(DEBUG, "Screencast: Picker: Running command \"%s\"", cmd);
fp = popen(cmd, "r");
if (fp == NULL) {
printf("Failed to run command\n");
@ -546,6 +548,8 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
if (strncmp(result, "screen:", 7) == 0) {
// find output
logprint(DEBUG, "Screencast: Attempting to find screen for %s", result);
char* display_name = malloc(strlen(result) - 7);
strncpy(display_name, result + 7, strlen(result) - 8);
display_name[strlen(result) - 8] = 0;
@ -568,6 +572,8 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
return res;
} else if (strncmp(result, "region:", 7) == 0) {
// find output
logprint(DEBUG, "Screencast: Attempting to find region for %s", result);
int atPos = 7;
for (int i = 7; i < (int)strlen(result); ++i) {
if (result[i] == '@'){
@ -611,9 +617,12 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
return res2;
} else if (strncmp(result, "window:", 7) == 0) {
if (ctx->hyprland_toplevel_manager == NULL) {
logprint(DEBUG, "Screencast: Window sharing attempted but the toplevel protocol is not implemented by the compositor!");
return res;
}
logprint(DEBUG, "Screencast: Attempting to find window for %s", result);
char *display_name = malloc(strlen(result) - 7);
strncpy(display_name, result + 7, strlen(result) - 8);
display_name[strlen(result) - 8] = 0;
@ -623,6 +632,7 @@ struct xdpw_share xdpw_wlr_chooser(struct xdpw_screencast_context *ctx) {
free(display_name);
return res;
} else {
logprint(DEBUG, "Screencast: Invalid result from hyprland-share-picker: ", result);
return res;
}