hhm - smart placement got borked... fixed

click to focus works pretty much swell now.. except for that mass of
comments i put in....

err... icccm focus modes handled 100% properly

err.. yeah. that.


SVN revision: 5697
This commit is contained in:
Carsten Haitzler 2001-11-16 05:39:34 +00:00
parent b97bed253d
commit 2bb9a1b0ab
8 changed files with 99 additions and 46 deletions

View File

@ -322,11 +322,7 @@ e_unmap(Ecore_Event * ev)
border_mouse_x, border_mouse_y);
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
}
e_border_release(b);
e_object_unref(E_OBJECT(b));
}
}
@ -360,11 +356,7 @@ e_destroy(Ecore_Event * ev)
border_mouse_x, border_mouse_y);
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(e->win, 0, 0, 0);
e_icccm_release(e->win);
}
e_border_release(b);
e_object_unref(E_OBJECT(b));
}
}
@ -465,8 +457,7 @@ e_focus_in(Ecore_Event * ev)
g = b->click_grab;
if (g)
{
/* find a grab that triggered this */
ecore_button_ungrab(b->win.main, g->button, g->mods, g->any_mod);
ecore_button_ungrab(b->win.container, g->button, g->mods, g->any_mod);
free(g);
b->click_grab = NULL;
}
@ -518,19 +509,18 @@ e_focus_out(Ecore_Event * ev)
if (e->key_grab) b->current.select_lost_from_grab = 1;
/* settings - click to focus would affect grabs */
if ((!b->client.internal) &&
(focus_mode == 2) &&
(e_focus_can_focus(b)))
(focus_mode == 2))
{
E_Grab *g;
g = NEW(E_Grab, 1);
ZERO(g, E_Grab, 1);
g->button = 0;
g->button = 1;
g->mods = ECORE_EVENT_KEY_MODIFIER_NONE;
g->any_mod = 0;
g->remove_after = 1;
ecore_button_grab(b->win.main, 0, XEV_BUTTON_PRESS, ECORE_EVENT_KEY_MODIFIER_NONE, 0);
ecore_window_button_grab_auto_replay_set(b->win.main, e_border_replay_query);
g->remove_after = 0;
ecore_button_grab(b->win.container, 1, XEV_BUTTON_PRESS, ECORE_EVENT_KEY_MODIFIER_NONE, 0);
ecore_window_button_grab_auto_replay_set(b->win.container, e_border_replay_query);
b->click_grab = g;
}
b->changed = 1;
@ -1428,6 +1418,17 @@ e_border_reshape(E_Border *b)
D_RETURN;
}
void
e_border_release(E_Border *b)
{
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
ecore_window_reparent(b->win.client, 0, b->current.x + pl, b->current.y + pt);
e_icccm_release(b->win.client);
}
E_Border *
e_border_adopt(Window win, int use_client_pos)
{
@ -1775,8 +1776,8 @@ e_border_remove_click_grab(E_Border *b)
E_Grab *g;
g = b->click_grab;
ecore_button_ungrab(b->win.main, g->button, g->mods, g->any_mod);
ecore_window_button_grab_auto_replay_set(b->win.main, NULL);
ecore_button_ungrab(b->win.container, g->button, g->mods, g->any_mod);
ecore_window_button_grab_auto_replay_set(b->win.container, NULL);
b->click_grab = NULL;
FREE(g);
}
@ -1800,19 +1801,18 @@ e_border_attach_mouse_grabs(E_Border *b)
grabs_db = e_config_get("grabs");
/* settings - click to focus would affect grabs */
if ((!b->current.selected) &&
(e_focus_can_focus(b)) &&
(focus_mode == 2))
{
E_Grab *g;
g = NEW(E_Grab, 1);
ZERO(g, E_Grab, 1);
g->button = 0;
g->button = 1;
g->mods = ECORE_EVENT_KEY_MODIFIER_NONE;
g->any_mod = 0;
g->remove_after = 1;
ecore_button_grab(b->win.main, 0, XEV_BUTTON_PRESS, ECORE_EVENT_KEY_MODIFIER_NONE, 0);
ecore_window_button_grab_auto_replay_set(b->win.main, e_border_replay_query);
g->remove_after = 0;
ecore_button_grab(b->win.container, 0, XEV_BUTTON_PRESS, ECORE_EVENT_KEY_MODIFIER_NONE, 0);
ecore_window_button_grab_auto_replay_set(b->win.container, e_border_replay_query);
b->click_grab = g;
}

View File

@ -149,6 +149,7 @@ E_Border *e_border_new(void);
void e_border_update_borders(void);
void e_border_apply_border(E_Border *b);
void e_border_reshape(E_Border *b);
void e_border_release(E_Border *b);
E_Border *e_border_adopt(Window win, int use_client_pos);
void e_border_adopt_children(Window win);
void e_border_remove_mouse_grabs(E_Border *b);

View File

@ -28,11 +28,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <unistd.h>
#include <stdio.h>
/*
#undef DEBUG
*/
#ifdef DEBUG
#define D(fmt, args...) printf(fmt, ## args);
#else
#define D(msg)
#define D(msg, args...)
#endif
#ifdef DEBUG_NEST

View File

@ -171,10 +171,7 @@ e_desktops_cleanup(E_Desktop *desk)
e_action_stop_by_object(E_OBJECT(b), NULL, 0, 0, 0, 0);
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(b->win.client, 0, 0, 0);
e_icccm_release(b->win.client);
}
e_border_release(b);
e_object_unref(E_OBJECT(b));
}

View File

@ -10,7 +10,7 @@ e_focus_set_focus(E_Border *b)
{
D_ENTER;
if (e_focus_can_focus(b)) ecore_focus_to_window(b->win.client);
e_icccm_send_focus_to(b->win.client, e_focus_can_focus(b));
D_RETURN;
}

View File

@ -56,6 +56,46 @@ e_icccm_move_resize(Window win, int x, int y, int w, int h)
D_RETURN;
}
void
e_icccm_send_focus_to(Window win, int takes_focus)
{
static Atom a_wm_take_focus = 0;
static Atom a_wm_protocols = 0;
int msg_focus = 0;
int *props;
int size;
D_ENTER;
ECORE_ATOM(a_wm_take_focus, "WM_TAKE_FOCUS");
ECORE_ATOM(a_wm_protocols, "WM_PROTOCOLS");
props = ecore_window_property_get(win, a_wm_protocols, XA_ATOM, &size);
if (props)
{
int i, num;
num = size / sizeof(int);
for (i = 0; i < num; i++)
{
if (props[i] == (int)a_wm_take_focus) msg_focus = 1;
}
FREE(props);
}
if (takes_focus)
ecore_focus_to_window(win);
if (msg_focus)
{
unsigned int data[5];
data[0] = a_wm_take_focus;
data[1] = CurrentTime;
ecore_window_send_client_message(win, a_wm_protocols, 32, data);
}
D_RETURN;
}
void
e_icccm_delete(Window win)
{
@ -393,9 +433,11 @@ e_icccm_get_hints(Window win, E_Border *b)
{
D_ENTER;
ecore_window_get_hints(win, &(b->client.takes_focus),
&(b->client.initial_state), NULL, NULL, NULL,
&(b->client.group));
ecore_window_get_hints(win,
&(b->client.takes_focus),
&(b->client.initial_state),
NULL, NULL, NULL,
&(b->client.group));
D_RETURN;
}
@ -443,6 +485,8 @@ e_icccm_get_state(Window win, E_Border *b)
D_RETURN;
UN(win);
UN(b);
}
void

View File

@ -4,6 +4,7 @@
#include "e.h"
void e_icccm_move_resize(Window win, int x, int y, int w, int h);
void e_icccm_send_focus_to(Window win, int takes_focus);
void e_icccm_delete(Window win);
void e_icccm_state_mapped(Window win);
void e_icccm_state_iconified(Window win);

View File

@ -503,20 +503,26 @@ e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mo
if (b->client.no_place)
D_RETURN_(1);
switch (mode)
{
case E_PLACE_MANUAL:
result = e_place_manual (b, desk, x, y);
case E_PLACE_SMART:
result = e_place_smart (b, desk, x, y);
case E_PLACE_MIDDLE:
result = e_place_middle (b, desk, x, y);
case E_PLACE_CASCADE:
result = e_place_cascade(b, desk, x, y);
case E_PLACE_RANDOM:
result = e_place_random (b, desk, x, y);
default:
case E_PLACE_MANUAL:
result = e_place_manual (b, desk, x, y);
break;
case E_PLACE_SMART:
result = e_place_smart (b, desk, x, y);
break;
case E_PLACE_MIDDLE:
result = e_place_middle (b, desk, x, y);
break;
case E_PLACE_CASCADE:
result = e_place_cascade(b, desk, x, y);
break;
case E_PLACE_RANDOM:
result = e_place_random (b, desk, x, y);
break;
default:
break;
}
D_RETURN_(result);