Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 658e5f76a07a4aad5ed30d82770081849b58d2f2
- Author: roel <RoelKl.UI.n@gmail.com>
- Date: Sat Jan 5 20:58:12 2019 +0100
- compiles and shows options in window manager tweaks correctly, not tested
- yet if the placement actually works already.
- Signed-off-by: picobyte <RoelKl.UI.n@gmail.com>
- diff --git a/defaults/defaults b/defaults/defaults
- index cf3d8703..5b2a7f72 100644
- --- a/defaults/defaults
- +++ b/defaults/defaults
- @@ -30,6 +30,8 @@ mousewheel_rollup=true
- move_opacity=100
- placement_mode=center
- placement_ratio=20
- +horizontal_placement_areas=2
- +vertical_placement_areas=2
- popup_opacity=100
- prevent_focus_stealing=false
- raise_delay=250
- diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
- index d5f711be..a34f899a 100644
- --- a/settings-dialogs/tweaks-settings.c
- +++ b/settings-dialogs/tweaks-settings.c
- @@ -205,6 +205,8 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
- GtkWidget *placement_ratio_scale = GTK_WIDGET (gtk_builder_get_object (builder, "placement_ratio_scale"));
- GtkWidget *placement_center_option = GTK_WIDGET (gtk_builder_get_object (builder, "placement_center_option"));
- GtkWidget *placement_mouse_option = GTK_WIDGET (gtk_builder_get_object (builder, "placement_mouse_option"));
- + GtkWidget *horizontal_placement_areas = GTK_WIDGET (gtk_builder_get_object (builder, "horizontal_placement_areas"));
- + GtkWidget *vertical_placement_areas = GTK_WIDGET (gtk_builder_get_object (builder, "vertical_placement_areas"));
- /* Compositing tab */
- GtkWidget *use_compositing_check = GTK_WIDGET (gtk_builder_get_object (builder, "use_compositing_check"));
- @@ -398,7 +400,14 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
- "/general/placement_ratio",
- G_TYPE_INT,
- (GObject *) gtk_range_get_adjustment (GTK_RANGE (placement_ratio_scale)), "value");
- -
- + xfconf_g_property_bind (xfwm4_channel,
- + "/general/horizontal_placement_areas",
- + G_TYPE_INT,
- + (GObject *) gtk_range_get_adjustment (GTK_RANGE (horizontal_placement_areas)), "value");
- + xfconf_g_property_bind (xfwm4_channel,
- + "/general/vertical_placement_areas",
- + G_TYPE_INT,
- + (GObject *) gtk_range_get_adjustment (GTK_RANGE (vertical_placement_areas)), "value");
- /* Compositing tab */
- xfconf_g_property_bind (xfwm4_channel,
- "/general/use_compositing",
- diff --git a/settings-dialogs/xfwm4-tweaks-dialog.glade b/settings-dialogs/xfwm4-tweaks-dialog.glade
- index 9e2cee50..5e662399 100644
- --- a/settings-dialogs/xfwm4-tweaks-dialog.glade
- +++ b/settings-dialogs/xfwm4-tweaks-dialog.glade
- @@ -39,6 +39,20 @@
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- + <object class="GtkAdjustment" id="adjustment7">
- + <property name="lower">1</property>
- + <property name="upper">10</property>
- + <property name="value">2</property>
- + <property name="step_increment">1</property>
- + <property name="page_increment">0</property>
- + </object>
- + <object class="GtkAdjustment" id="adjustment8">
- + <property name="lower">1</property>
- + <property name="upper">10</property>
- + <property name="value">2</property>
- + <property name="step_increment">1</property>
- + <property name="page_increment">0</property>
- + </object>
- <object class="XfceTitledDialog" id="main-dialog">
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Window Manager Tweaks</property>
- @@ -821,6 +835,70 @@ when switching via keyboard shortcuts</property>
- <property name="position">2</property>
- </packing>
- </child>
- + <child>
- + <object class="GtkLabel" id="label28">
- + <property name="visible">True</property>
- + <property name="can_focus">False</property>
- + <property name="xalign">0</property>
- + <property name="label" translatable="yes">_Horizontal number of areas for window snapping:</property>
- + <property name="use_underline">True</property>
- + <property name="mnemonic_widget">horizontal_placement_areas</property>
- + </object>
- + <packing>
- + <property name="expand">False</property>
- + <property name="fill">False</property>
- + <property name="position">3</property>
- + </packing>
- + </child>
- + <child>
- + <object class="GtkScale" id="horizontal_placement_areas">
- + <property name="visible">True</property>
- + <property name="can_focus">True</property>
- + <property name="orientation">horizontal</property>
- + <property name="adjustment">adjustment7</property>
- + <property name="restrict_to_fill_level">False</property>
- + <property name="digits">0</property>
- + <property name="draw_value">True</property>
- + <property name="value-pos">GTK_POS_LEFT</property>
- + </object>
- + <packing>
- + <property name="expand">True</property>
- + <property name="fill">True</property>
- + <property name="position">4</property>
- + </packing>
- + </child>
- + <child>
- + <object class="GtkLabel" id="label31">
- + <property name="visible">True</property>
- + <property name="can_focus">False</property>
- + <property name="xalign">0</property>
- + <property name="label" translatable="yes">_Vertical number of areas for window snapping:</property>
- + <property name="use_underline">True</property>
- + <property name="mnemonic_widget">vertical_placement_areas</property>
- + </object>
- + <packing>
- + <property name="expand">False</property>
- + <property name="fill">False</property>
- + <property name="position">5</property>
- + </packing>
- + </child>
- + <child>
- + <object class="GtkScale" id="vertical_placement_areas">
- + <property name="visible">True</property>
- + <property name="can_focus">True</property>
- + <property name="orientation">horizontal</property>
- + <property name="adjustment">adjustment8</property>
- + <property name="restrict_to_fill_level">False</property>
- + <property name="digits">0</property>
- + <property name="draw_value">True</property>
- + <property name="value-pos">GTK_POS_LEFT</property>
- + </object>
- + <packing>
- + <property name="expand">True</property>
- + <property name="fill">True</property>
- + <property name="position">6</property>
- + </packing>
- + </child>
- </object>
- <packing>
- <property name="position">4</property>
- diff --git a/src/placement.c b/src/placement.c
- index a643ef08..d2d919ba 100644
- --- a/src/placement.c
- +++ b/src/placement.c
- @@ -735,14 +735,14 @@ centerPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
- }
- static void
- -mousePlacement (Client * c, int full_x, int full_y, int full_w, int full_h, int mx, int my)
- +mousePlacement (Client * c, int full_x, int full_y, int full_w, int full_h, int mx, int my, int hdiv, int vdiv)
- {
- g_return_if_fail (c != NULL);
- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
- - c->x = mx + frameExtentLeft(c) - frameExtentWidth(c) / 2;
- - c->y = my + frameExtentTop(c) - frameExtentHeight(c) / 2;
- + c->x = mx + frameExtentLeft(c) - frameExtentWidth(c) / hdiv;
- + c->y = my + frameExtentTop(c) - frameExtentHeight(c) / vdiv;
- c->x = MIN (c->x, full_x + full_w - frameExtentWidth(c) + frameExtentLeft(c));
- c->y = MIN (c->y, full_y + full_h - frameExtentHeight(c) + frameExtentTop(c));
- @@ -828,7 +828,17 @@ clientInitPosition (Client * c)
- {
- if (screen_info->params->placement_mode == PLACE_MOUSE)
- {
- - mousePlacement (c, full_x, full_y, full_w, full_h, msx, msy);
- + int hdiv = screen_info->params->horizontal_placement_areas;
- + if (hdiv < 1 || hdiv > 10)
- + {
- + hdiv = 2;
- + }
- + int vdiv = screen_info->params->vertical_placement_areas;
- + if (vdiv < 1 || vdiv > 10)
- + {
- + vdiv = 2;
- + }
- + mousePlacement (c, full_x, full_y, full_w, full_h, msx, msy, hdiv, vdiv);
- }
- else
- {
- diff --git a/src/settings.c b/src/settings.c
- index 7dbcffc6..b8dcbb5a 100644
- --- a/src/settings.c
- +++ b/src/settings.c
- @@ -680,6 +680,8 @@ loadSettings (ScreenInfo *screen_info)
- {"move_opacity", NULL, G_TYPE_INT, TRUE},
- {"placement_mode", NULL, G_TYPE_STRING, TRUE},
- {"placement_ratio", NULL, G_TYPE_INT, TRUE},
- + {"horizontal_placement_areas", NULL, G_TYPE_INT, TRUE},
- + {"vertical_placement_areas", NULL, G_TYPE_INT, TRUE},
- {"popup_opacity", NULL, G_TYPE_INT, TRUE},
- {"prevent_focus_stealing", NULL, G_TYPE_BOOLEAN, TRUE},
- {"raise_delay", NULL, G_TYPE_INT, TRUE},
- @@ -798,6 +800,10 @@ loadSettings (ScreenInfo *screen_info)
- CLAMP (getIntValue ("popup_opacity", rc), 0, 100);
- screen_info->params->placement_ratio =
- CLAMP (getIntValue ("placement_ratio", rc), 0, 100);
- + screen_info->params->horizontal_placement_areas =
- + CLAMP (getIntValue ("horizontal_placement_areas", rc), 1, 10);
- + screen_info->params->vertical_placement_areas =
- + CLAMP (getIntValue ("vertical_placement_areas", rc), 1, 10);
- screen_info->params->shadow_opacity =
- CLAMP (getIntValue ("shadow_opacity", rc), 0, 100);
- screen_info->params->show_app_icon =
- @@ -1194,6 +1200,14 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
- {
- screen_info->params->placement_ratio = CLAMP (g_value_get_int(value), 0, 100);
- }
- + else if (!strcmp (name, "horizontal_placement_areas"))
- + {
- + screen_info->params->horizontal_placement_areas = CLAMP (g_value_get_int(value), 1, 10);
- + }
- + else if (!strcmp (name, "vertical_placement_areas"))
- + {
- + screen_info->params->vertical_placement_areas = CLAMP (g_value_get_int(value), 1, 10);
- + }
- else if (!strcmp (name, "cycle_tabwin_mode"))
- {
- screen_info->params->cycle_tabwin_mode = CLAMP (g_value_get_int(value), 0, 1);
- diff --git a/src/settings.h b/src/settings.h
- index 334acdd4..0fc4cd8b 100644
- --- a/src/settings.h
- +++ b/src/settings.h
- @@ -181,6 +181,8 @@ struct _XfwmParams
- int move_opacity;
- int placement_mode;
- int placement_ratio;
- + int horizontal_placement_areas;
- + int vertical_placement_areas;
- int popup_opacity;
- int raise_delay;
- int resize_opacity;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement