Add mode add/del functions to ecore_x_randr
authorleif <leif@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 16 Feb 2012 19:26:30 +0000 (19:26 +0000)
committerleif <leif@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 16 Feb 2012 19:26:30 +0000 (19:26 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@68031 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xlib/ecore_x_randr_12.c

index 788344b..ea6b860 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
         * Add ecore_imf APIs to set return key type, disable return key.
 
+2012-02-16  Leif Middelschulte (T_UNIX)
+
+        * Add ecore_x_randr_mode_add to add a mode to a display
+        * Add ecore_x_randr_mode_del to remove a mode from the display
+        * Add ecore_x_randr_output_mode_add to add a mode to an output
+        * Add ecore_x_randr_output_mode_del to remove a mode from an output
index 29992b9..a378cdf 100644 (file)
@@ -2749,6 +2749,11 @@ EAPI Eina_Bool
 EAPI Ecore_X_Randr_Mode_Info **
 ecore_x_randr_modes_info_get(Ecore_X_Window root,
                              int *num);
+EAPI Ecore_X_Randr_Mode
+ecore_x_randr_mode_info_add(Ecore_X_Window root,
+                            Ecore_X_Randr_Mode_Info *mode_info);
+EAPI void
+ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode);
 EAPI Ecore_X_Randr_Mode_Info *
 ecore_x_randr_mode_info_get(Ecore_X_Window root,
                             Ecore_X_Randr_Mode mode);
@@ -2840,6 +2845,12 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
                                     Ecore_X_Randr_Crtc crtc_r2,
                                     Ecore_X_Randr_Output_Policy policy,
                                     Ecore_X_Randr_Relative_Alignment alignment);
+EAPI Eina_Bool
+ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
+                              Ecore_X_Randr_Mode mode);
+EAPI void
+ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
+                              Ecore_X_Randr_Mode mode);
 EAPI Ecore_X_Randr_Mode *
 ecore_x_randr_output_modes_get(Ecore_X_Window root,
                                Ecore_X_Randr_Output output,
index 38218a5..70086a0 100644 (file)
@@ -380,6 +380,48 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root,
 }
 
 /*
+ * @brief add a mode to a display
+ * @param root window to which's screen's ressources are added
+ * @param mode_info
+ * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
+ * adding failed.
+ * @since 1.2.0
+ */
+EAPI Ecore_X_Randr_Mode
+ecore_x_randr_mode_info_add(Ecore_X_Window root,
+                            Ecore_X_Randr_Mode_Info *mode_info)
+{
+#ifdef ECORE_XRANDR
+   RANDR_CHECK_1_2_RET(EINA_FALSE);
+   Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
+
+   if (_ecore_x_randr_root_validate(root) && mode_info)
+     mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info);
+
+   return mode;
+#else
+   return Ecore_X_Randr_None;
+#endif
+}
+
+/*
+ * @brief delete a mode from the display
+ * @param mode_info
+ * @since 1.2.0
+ */
+EAPI void
+ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode)
+{
+#ifdef ECORE_XRANDR
+   RANDR_CHECK_1_2_RET();
+
+   XRRDestroyMode(_ecore_x_disp, mode);
+#else
+   return;
+#endif
+}
+
+/*
  * @brief get detailed information for a given mode id
  * @param root window which's screen's ressources are queried
  * @param mode the XID which identifies the mode of interest
@@ -1364,6 +1406,54 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
 #endif
 }
 
+/*
+ * @brief add given mode to given output
+ * @param output the output the mode is added to
+ * @param mode the mode added to the output
+ * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE
+ * Additionally, if xcb backend is used, the success of the addition is reported
+ * back directly.
+ * @since 1.2.0
+ */
+EAPI Eina_Bool
+ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
+                              Ecore_X_Randr_Mode mode)
+{
+#ifdef ECORE_XRANDR
+   RANDR_CHECK_1_2_RET(EINA_FALSE);
+
+   if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
+     return EINA_FALSE;
+
+   XRRAddOutputMode(_ecore_x_disp, output, mode);
+   return EINA_TRUE;
+#else
+   return EINA_FALSE;
+#endif
+}
+
+/*
+ * @brief delete given mode from given output
+ * @param output the output the mode is removed from
+ * @param mode the mode removed from the output
+ * @since 1.2.0
+ */
+EAPI void
+ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
+                              Ecore_X_Randr_Mode mode)
+{
+#ifdef ECORE_XRANDR
+   RANDR_CHECK_1_2_RET();
+
+   if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
+     return;
+
+   XRRDeleteOutputMode(_ecore_x_disp, output, mode);
+#else
+   return;
+#endif
+}
+
 EAPI Ecore_X_Randr_Mode *
 ecore_x_randr_output_modes_get(Ecore_X_Window root,
                                Ecore_X_Randr_Output output,