virtual: support tdm_client output_set_mode
[platform/core/uifw/libtdm.git] / client / tdm_client.c
index f5c69db..136a08a 100644 (file)
@@ -1228,11 +1228,15 @@ tdm_error
 tdm_client_output_set_mode(tdm_client_output *output, int index)
 {
        tdm_private_client_output *private_output;
+       tdm_private_client *private_client;
 
        TDM_RETURN_VAL_IF_FAIL(output != NULL, TDM_ERROR_INVALID_PARAMETER);
-       TDM_RETURN_VAL_IF_FAIL(index < 0, TDM_ERROR_INVALID_PARAMETER);
+       TDM_RETURN_VAL_IF_FAIL(index >= 0, TDM_ERROR_INVALID_PARAMETER);
 
        private_output = (tdm_private_client_output*)output;
+       private_client = private_output->private_client;
+
+       pthread_mutex_lock(&private_client->lock);
 
        if (private_output->available_modes.count - 1 < index)
                return TDM_ERROR_INVALID_PARAMETER;
@@ -1243,6 +1247,8 @@ tdm_client_output_set_mode(tdm_client_output *output, int index)
 
        wl_tdm_output_set_mode(private_output->output, index);
 
+       pthread_mutex_unlock(&private_client->lock);
+
        return TDM_ERROR_NONE;
 }