Skip to content

Commit 5a8d91f

Browse files
authored
54 add VRR for river (#64)
1 parent 7f5f432 commit 5a8d91f

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/layout.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void apply(void) {
289289
slist_free(&heads_changing);
290290
}
291291

292-
bool handle_success(void) {
292+
void handle_success(void) {
293293
if (head_changing_mode) {
294294

295295
// succesful mode change is not always reported
@@ -299,20 +299,21 @@ bool handle_success(void) {
299299

300300
} else if (head_changing_adaptive_sync) {
301301

302-
// adaptive sync changes are not reported as failures, but never try again
302+
// sway reports adaptive sync failure as success
303303
if (head_current_adaptive_sync_not_desired(head_changing_adaptive_sync)) {
304304
log_info("\n%s: Cannot enable VRR, display or compositor may not support it.", head_changing_adaptive_sync->name);
305305
head_changing_adaptive_sync->adaptive_sync_failed = true;
306-
return false;
306+
return;
307307
}
308308
}
309309

310-
return true;
310+
log_info("\nChanges successful");
311311
}
312312

313313
void handle_failure(void) {
314314

315315
if (head_changing_mode) {
316+
log_error("\nChanges failed");
316317

317318
// mode setting failure, try again
318319
log_error(" %s:", head_changing_mode->name);
@@ -323,7 +324,15 @@ void handle_failure(void) {
323324
head_changing_mode->current.mode = NULL;
324325

325326
head_changing_mode = NULL;
327+
328+
} else if (head_changing_adaptive_sync && head_current_adaptive_sync_not_desired(head_changing_adaptive_sync)) {
329+
330+
// river reports adaptive sync failure as failure
331+
log_info("\n%s: Cannot enable VRR, display or compositor may not support it.", head_changing_adaptive_sync->name);
332+
head_changing_adaptive_sync->adaptive_sync_failed = true;
333+
326334
} else {
335+
log_error("\nChanges failed");
327336

328337
// any other failures are fatal
329338
exit_fail();
@@ -340,9 +349,7 @@ void layout(void) {
340349

341350
switch (displ->config_state) {
342351
case SUCCEEDED:
343-
if (handle_success()) {
344-
log_info("\nChanges successful");
345-
}
352+
handle_success();
346353
displ->config_state = IDLE;
347354
break;
348355

@@ -351,7 +358,6 @@ void layout(void) {
351358
return;
352359

353360
case FAILED:
354-
log_error("\nChanges failed");
355361
handle_failure();
356362
displ->config_state = IDLE;
357363
break;

0 commit comments

Comments
 (0)