display-config: Use separate variables to get the closest mode
This will allow reusing the function in a following commit. No change in behavior.
This commit is contained in:
parent
c454430220
commit
63a957591c
1 changed files with 13 additions and 6 deletions
|
@ -651,7 +651,10 @@ cc_display_monitor_dbus_set_underscanning (CcDisplayMonitor *pself,
|
||||||
|
|
||||||
static CcDisplayMode *
|
static CcDisplayMode *
|
||||||
cc_display_monitor_dbus_get_closest_mode (CcDisplayMonitorDBus *self,
|
cc_display_monitor_dbus_get_closest_mode (CcDisplayMonitorDBus *self,
|
||||||
CcDisplayModeDBus *mode)
|
int width,
|
||||||
|
int height,
|
||||||
|
double refresh_rate,
|
||||||
|
guint32 flags)
|
||||||
{
|
{
|
||||||
CcDisplayModeDBus *best = NULL;
|
CcDisplayModeDBus *best = NULL;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
@ -660,12 +663,12 @@ cc_display_monitor_dbus_get_closest_mode (CcDisplayMonitorDBus *self,
|
||||||
{
|
{
|
||||||
CcDisplayModeDBus *similar = l->data;
|
CcDisplayModeDBus *similar = l->data;
|
||||||
|
|
||||||
if (similar->width != mode->width ||
|
if (similar->width != width ||
|
||||||
similar->height != mode->height)
|
similar->height != height)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (similar->refresh_rate == mode->refresh_rate &&
|
if (similar->refresh_rate == refresh_rate &&
|
||||||
(similar->flags & MODE_INTERLACED) == (mode->flags & MODE_INTERLACED))
|
(similar->flags & MODE_INTERLACED) == (flags & MODE_INTERLACED))
|
||||||
{
|
{
|
||||||
best = similar;
|
best = similar;
|
||||||
break;
|
break;
|
||||||
|
@ -692,7 +695,11 @@ cc_display_monitor_dbus_set_mode (CcDisplayMonitor *pself,
|
||||||
|
|
||||||
g_return_if_fail (mode_dbus != NULL);
|
g_return_if_fail (mode_dbus != NULL);
|
||||||
|
|
||||||
new_mode = cc_display_monitor_dbus_get_closest_mode (self, mode_dbus);
|
new_mode = cc_display_monitor_dbus_get_closest_mode (self,
|
||||||
|
mode_dbus->width,
|
||||||
|
mode_dbus->height,
|
||||||
|
mode_dbus->refresh_rate,
|
||||||
|
mode_dbus->flags);
|
||||||
|
|
||||||
self->current_mode = new_mode;
|
self->current_mode = new_mode;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue