Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 7717
Collapse All | Expand All

(-)fluxbox-0.1.11/src/Screen.cc (-13 / +16 lines)
Lines 393-395 Link Here
393
393
394
	raiseWindows(0, 0);
394
	raiseWindows(Workspace::Stack());
395
395
Lines 624-626 Link Here
624
		initMenu();
624
		initMenu();
625
		raiseWindows(0, 0);
625
		raiseWindows(Workspace::Stack());
626
		rootmenu->reconfigure();		
626
		rootmenu->reconfigure();		
Lines 657-659 Link Here
657
	initMenu();
657
	initMenu();
658
	raiseWindows(0, 0);
658
	raiseWindows(Workspace::Stack());
659
659
Lines 1017-1021 Link Here
1017
1017
1018
void BScreen::raiseWindows(Window *workspace_stack, int num) {
1018
void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
1019
1019
1020
	Window session_stack[(num + workspacesList.size() + rootmenuList.size() + 30)];
1020
	Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)];
1021
	int i = 0;	
1021
	int i = 0;	
Lines 1071-1076 Link Here
1071
	#endif // SLIT
1071
	#endif // SLIT
1072
	
1072
1073
	int k=num;
1073
	if (!workspace_stack.empty()) {
1074
	while (k--)
1074
		Workspace::Stack::const_reverse_iterator it = workspace_stack.rbegin();
1075
		session_stack[i++] = *(workspace_stack + k);
1075
		Workspace::Stack::const_reverse_iterator it_end = workspace_stack.rend();
1076
		for (; it != it_end; ++it)
1077
			session_stack[i++] = (*it);
1078
	}
1076
1079
Lines 1137-1142 Link Here
1137
	int focused_window_number = -1;
1140
	int focused_window_number = -1;
1138
	FluxboxWindow *focused;
1141
	FluxboxWindow *focused = fluxbox->getFocusedWindow();
1139
	const int num_windows = getCurrentWorkspace()->getCount();
1142
	const int num_windows = getCurrentWorkspace()->getCount();
1140
	
1143
	
1141
	if ((focused = fluxbox->getFocusedWindow())) {
1144
	if (focused != 0) {
1142
		if (focused->getScreen()->getScreenNumber() == 
1145
		if (focused->getScreen()->getScreenNumber() == 
Lines 1150-1152 Link Here
1150
		Workspace *wksp = getCurrentWorkspace();
1153
		Workspace *wksp = getCurrentWorkspace();
1151
		Workspace::Windows wins = wksp->getWindowList();
1154
		Workspace::Windows &wins = wksp->getWindowList();
1152
		Workspace::Windows::iterator it = wins.begin();
1155
		Workspace::Windows::iterator it = wins.begin();
Lines 1163-1165 Link Here
1163
1166
1164
		if (*it != focused)
1167
		if (*it != focused && it != wins.end())
1165
			wksp->raiseWindow(*it);
1168
			wksp->raiseWindow(*it);
(-)fluxbox-0.1.11/src/Screen.hh (-1 / +1 lines)
Lines 223-225 Link Here
223
	void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true);
223
	void sendToWorkspace(unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true);
224
	void raiseWindows(Window *workspace_stack, int num);
224
	void raiseWindows(const Workspace::Stack &workspace_stack);
225
	void reassociateGroup(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky);
225
	void reassociateGroup(FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky);
(-)fluxbox-0.1.11/src/Slit.cc (-2 / +4 lines)
Lines 681-683 Link Here
681
		Window w[1] = { frame.window };
681
		Window w[1] = { frame.window };
682
		screen->raiseWindows(w, 1);
682
		Workspace::Stack st;
683
		st.push_back(frame.window);
684
		screen->raiseWindows(st);
683
	} else if (e->button == Button2 && (! on_top)) {
685
	} else if (e->button == Button2 && (! on_top)) {
Lines 890-892 Link Here
890
			if (slit.isOnTop())
892
			if (slit.isOnTop())
891
				screen()->raiseWindows(0, 0);
893
				screen()->raiseWindows(Workspace::Stack());
892
		
894
		
(-)fluxbox-0.1.11/src/Tab.cc (-2 / +5 lines)
Lines 157-160 Link Here
157
	//raise tabs
157
	//raise tabs
158
	for (tab = getFirst(this); tab!=0; tab = tab->m_next)
158
	Workspace::Stack st;
159
		m_win->getScreen()->raiseWindows(&tab->m_tabwin, 1);
159
	for (tab = getFirst(this); tab!=0; tab = tab->m_next) {
160
		st.push_back(tab->m_tabwin);
161
	}
162
	m_win->getScreen()->raiseWindows(st);
160
}
163
}
(-)fluxbox-0.1.11/src/Toolbar.cc (-3 / +4 lines)
Lines 1024-1027 Link Here
1024
		else if (! on_top) {
1024
		else if (! on_top) {
1025
			Window w[1] = { frame.window };
1025
			Workspace::Stack st;
1026
			screen->raiseWindows(w, 1);
1026
			st.push_back(frame.window);
1027
			screen->raiseWindows(st);
1027
		}
1028
		}
Lines 1317-1319 Link Here
1317
			if (toolbar->isOnTop())
1318
			if (toolbar->isOnTop())
1318
				toolbar->screen->raiseWindows((Window *) 0, 0);
1319
				toolbar->screen->raiseWindows(Workspace::Stack());
1319
			
1320
			
(-)fluxbox-0.1.11/src/Window.cc (-88 / +63 lines)
Lines 142-144 Link Here
142
	client.wm_hint_flags = client.normal_hint_flags = 0;
142
	client.wm_hint_flags = client.normal_hint_flags = 0;
143
	client.transient_for = client.transient = 0;
143
	client.transient_for = 0;
144
	client.mwm_hint = (MwmHints *) 0;
144
	client.mwm_hint = (MwmHints *) 0;
Lines 376-393 Link Here
376
376
377
377
	if (client.transient_for != 0) {
378
	if (isTransient()) {
379
		//guard from having transient_for = this
380
		if (client.transient_for == this) {
381
#ifdef DEBUG
382
			cerr<<__FILE__<<"("<<__LINE__<<"): WARNING! client.transient_for == this WARNING!"<<endl;
383
			assert(0);
384
#endif //DEBUG
385
			client.transient_for = 0;
386
			
387
		}
388
		if (client.transient == this) {
389
			client.transient = 0;
390
			assert(0);
391
		}
392
		fluxbox->setFocusedWindow(client.transient_for);
378
		fluxbox->setFocusedWindow(client.transient_for);
379
		client.transient_for->client.transients.remove(this);
380
		client.transient_for = 0;			
381
	}
382
	
383
	while (!client.transients.empty()) {
384
		client.transients.back()->client.transient_for = 0;
385
		client.transients.pop_back();
393
	}
386
	}
Lines 399-405 Link Here
399
392
400
	if (transient && client.transient_for)
401
		client.transient_for->client.transient = client.transient;
402
	if (client.transient)
403
		client.transient->client.transient_for = client.transient_for;
404
		
405
	destroyTitlebar();	
393
	destroyTitlebar();	
Lines 1793-1797 Link Here
1793
1781
1794
	if (client.transient && modal) {
1782
	if (client.transients.size() && modal) {
1795
		fluxbox->ungrab();
1783
		fluxbox->ungrab();
1796
		return client.transient->setInputFocus();
1784
		std::list<FluxboxWindow *>::iterator it = client.transients.begin();
1785
		std::list<FluxboxWindow *>::iterator it_end = client.transients.end();
1786
		for (; it != it_end; ++it) {
1787
			if ((*it)->modal)
1788
				return (*it)->setInputFocus();
1789
		}
1797
	} else {
1790
	} else {
Lines 1886-1892 Link Here
1886
		
1879
		
1887
	if (client.transient) {
1880
	if (client.transients.size()) {
1888
		if (! client.transient->iconic)
1881
		std::list<FluxboxWindow *>::iterator it = client.transients.begin();
1889
			client.transient->iconify();
1882
		std::list<FluxboxWindow *>::iterator it_end = client.transients.end();
1883
		for (; it != it_end; ++it) {
1884
			if (! (*it)->iconic)
1885
				(*it)->iconify();
1886
		}
1890
	}
1887
	}
1891
1892
#ifdef GNOME
1888
#ifdef GNOME
Lines 1919-1922 Link Here
1919
1915
1920
	if (reassoc && client.transient) client.transient->deiconify(true, false);
1916
	if (reassoc && client.transients.size()) {
1921
	
1917
		// deiconify all transients
1918
		std::list<FluxboxWindow *>::iterator it = client.transients.begin();
1919
		std::list<FluxboxWindow *>::iterator it_end = client.transients.end();
1920
		for (; it != it_end; ++it) {
1921
			(*it)->deiconify(true, false);
1922
		}
1923
	}
1924
1922
	if (tab)
1925
	if (tab)
Lines 3758-3764 Link Here
3758
void FluxboxWindow::checkTransient() {
3761
void FluxboxWindow::checkTransient() {
3759
	// default values
3762
	// remove us from parent
3763
	if (client.transient_for != 0) {
3764
		client.transient_for->client.transients.remove(this);
3765
	}
3760
	client.transient_for = 0;
3766
	client.transient_for = 0;
3761
	client.transient = 0;
3762
	
3767
	
3763
	Fluxbox *fluxbox = Fluxbox::instance();
3764
	// determine if this is a transient window
3768
	// determine if this is a transient window
Lines 3769-3830 Link Here
3769
	}
3773
	}
3770
3774
	
3775
	
3771
	if (win == client.window)
3776
	if (win == client.window)
3772
		return;
3777
		return;
3773
3778
	
3774
	if (win && (win != client.window)) {
3775
		FluxboxWindow *tr = fluxbox->searchWindow(win);
3776
		if (tr != 0) {
3777
3778
			while (tr->client.transient != 0) {
3779
				tr = tr->client.transient;
3780
				if (tr == tr->client.transient) { //ops! something is wrong with transient
3781
					tr->client.transient = 0;
3782
					if (tr->client.transient_for == tr)
3783
						tr->client.transient_for = 0;
3784
					break;
3785
				}
3786
			}
3787
			
3788
			if (tr != this) {
3789
				client.transient_for = tr;
3790
				tr->client.transient = this;
3791
				transient = true;
3792
			} else {
3793
				client.transient_for = 0;
3794
				client.transient = 0;
3795
			}			
3796
			if (client.transient_for != 0) {
3797
				stuck = client.transient_for->stuck;
3798
			}
3799
			
3800
		} else if (win == client.window_group) {
3801
			if ((tr = fluxbox->searchGroup(win, this))) {
3802
					
3803
				while (tr->client.transient != 0) {
3804
					tr = tr->client.transient;
3805
					if (tr && tr == tr->client.transient) { //ops! somehtin is wrong with transient
3806
						tr->client.transient = 0;
3807
					}
3808
				}
3809
			
3810
				if (tr != this) {
3811
					client.transient_for = tr;
3812
					tr->client.transient = this;
3813
					transient = true;
3814
				} else {	
3815
					client.transient_for = 0;
3816
					client.transient = 0;
3817
				}
3818
				
3819
				if (client.transient_for != 0) {
3820
					stuck = client.transient_for->stuck;
3821
				}
3822
				
3823
			}
3824
		}
3825
	}
3826
3827
	if (win == screen->getRootWindow())
3779
	if (win == screen->getRootWindow())
3828
		modal = true;
3780
		modal = true;
3829
3781
	
3782
	client.transient_for = Fluxbox::instance()->searchWindow(win);
3783
	if (client.transient_for != 0 && 
3784
		client.window_group != None && win == client.window_group) {
3785
		
3786
		FluxboxWindow *leader = Fluxbox::instance()->searchGroup(win, this);
3787
		if (leader != 0) 
3788
			client.transient_for = leader;
3789
		return;
3790
	}
3791
	
3792
	// make sure we don't have deadlock loop in transient chain
3793
	for (FluxboxWindow *w = this; w != 0; w = w->client.transient_for) {
3794
		if (w == w->client.transient_for) {
3795
			w->client.transient_for = 0;
3796
		}
3797
	}
3798
	
3799
	if (client.transient_for != 0) {
3800
		client.transient_for->client.transients.push_back(this);
3801
		// make sure we only have on instance of this
3802
		client.transient_for->client.transients.unique(); 
3803
		stuck = client.transient_for->stuck;
3804
	}
3830
}
3805
}
(-)fluxbox-0.1.11/src/Window.hh (-6 / +6 lines)
Lines 130-133 Link Here
130
	//@{
130
	//@{
131
	inline bool isTransient() const { return ((transient) ? true : false); }
131
	inline bool isTransient() const { return ((client.transient_for) ? true : false); }
132
	inline bool hasTransient() const { return ((client.transient) ? true : false); }
132
	inline bool hasTransient() const { return ((client.transients.size()) ? true : false); }
133
	inline bool isManaged() const { return managed; }
133
	inline bool isManaged() const { return managed; }
Lines 151-154 Link Here
151
	inline Tab *getTab() { return tab; }
151
	inline Tab *getTab() { return tab; }
152
	inline const FluxboxWindow *getTransient() const { return client.transient; }
152
	inline const std::list<FluxboxWindow *> &getTransients() const { return client.transients; }
153
	inline FluxboxWindow *getTransient() { return client.transient; }	
153
	inline std::list<FluxboxWindow *> &getTransients() { return client.transients; }	
154
	inline const FluxboxWindow *getTransientFor() const { return client.transient_for; }
154
	inline const FluxboxWindow *getTransientFor() const { return client.transient_for; }
Lines 271-274 Link Here
271
	struct _client {
271
	struct _client {
272
		FluxboxWindow *transient_for, // which window are we a transient for?
272
		FluxboxWindow *transient_for; // which window are we a transient for?
273
			*transient;  // which window is our transient?
273
		std::list<FluxboxWindow *> transients;  // which window is our transient?
274
		Window window, window_group;
274
		Window window, window_group;
(-)fluxbox-0.1.11/src/Workspace.cc (-75 / +100 lines)
Lines 57-58 Link Here
57
57
58
namespace { // anonymous
59
60
int countTransients(const FluxboxWindow &win) {
61
  if (win.getTransients().size() == 0)
62
	  return 0;
63
  // now go throu the entire tree and count transients
64
  size_t ret = win.getTransients().size();    
65
  std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin();
66
  std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end();
67
  for (; it != it_end; ++it)
68
	  ret += countTransients(*(*it));
69
70
  return ret;
71
}
72
73
};
74
58
Workspace::GroupList Workspace::m_groups;
75
Workspace::GroupList Workspace::m_groups;
Lines 220-267 Link Here
220
void Workspace::raiseWindow(FluxboxWindow *w) {
237
void Workspace::raiseWindow(FluxboxWindow *w) {
221
	FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
238
	FluxboxWindow *win = w;
222
223
	while (bottom->isTransient() && bottom->getTransientFor() &&
224
			bottom->getTransientFor() != bottom) { //prevent infinite loop
225
#ifdef DEBUG
226
		assert(bottom != bottom->getTransientFor());		
227
#endif // DEBUG
228
		bottom = bottom->getTransientFor();
229
		
230
	}
231
232
	int i = 1;
233
	win = bottom;
234
	while (win->hasTransient() && win->getTransient() &&
235
			win->getTransient() != win) {//prevent infinite loop
236
#ifdef DEBUG
237
		assert(win != win->getTransient());
238
#endif // DEBUG
239
		win = win->getTransient();
240
		i++;
241
	}
242
243
	Window *nstack = new Window[i], *curr = nstack;
244
	Workspace *wkspc;
245
239
246
	win = bottom;
240
	while (win->isTransient() && win->getTransientFor())
247
	while (1) {
241
		win = win->getTransientFor();
248
		*(curr++) = win->getFrameWindow();
242
	
249
		screen->updateNetizenWindowRaise(win->getClientWindow());
243
	int i = 1 + countTransients(*win);
250
251
		if (! win->isIconic()) {
252
			wkspc = screen->getWorkspace(win->getWorkspaceNumber());
253
			wkspc->stackingList.remove(win);
254
			wkspc->stackingList.push_front(win);
255
		}
256
257
		if (! win->hasTransient() || ! win->getTransient() ||
258
			win->getTransient() == win) //prevent infinite loop
259
			break;
260
		
261
		win = win->getTransient();
262
	}
263
244
264
	screen->raiseWindows(nstack, i);
245
	Stack nstack(i);
246
	Stack::iterator stackit = nstack.begin();
247
	
248
	*(stackit++) = win->getFrameWindow();
249
	screen->updateNetizenWindowRaise(win->getClientWindow());
250
	if (! win->isIconic()) {
251
		Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
252
		wkspc->stackingList.remove(win);
253
		wkspc->stackingList.push_front(win);
254
	}	
255
	
256
	raiseAndFillStack(stackit, *win);
265
257
266
	delete [] nstack;
258
	screen->raiseWindows(nstack);
267
}
259
}
Lines 275-313 Link Here
275
267
276
	int i = 1;
277
	win = bottom;
268
	win = bottom;
278
	while (win->hasTransient() && win->getTransient() && 
269
	int i = 1 + countTransients(*w);
279
			win->getTransient() != win) { //prevent infinite loop
280
		win = win->getTransient();
281
282
		i++;
283
	}
284
285
	Window *nstack = new Window[i], *curr = nstack;
286
	Workspace *wkspc;
287
288
	while (True) {
289
		*(curr++) = win->getFrameWindow();
290
		screen->updateNetizenWindowLower(win->getClientWindow());
291
292
		if (! win->isIconic()) {
293
			wkspc = screen->getWorkspace(win->getWorkspaceNumber());
294
			wkspc->stackingList.remove(win);
295
			wkspc->stackingList.push_back(win);
296
		}
297
298
		if (! win->getTransientFor() || 
299
			win->getTransientFor() == win)//prevent infinite loop
300
			break;
301
270
302
		win = win->getTransientFor();
271
	Stack st(i);
272
	Stack::iterator stackit = st.begin();
273
	lowerAndFillStack(stackit, *win);
274
	(*stackit) = win->getFrameWindow();
275
276
	screen->updateNetizenWindowLower(win->getClientWindow());
277
	if (! win->isIconic()) {
278
		Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
279
		wkspc->stackingList.remove(win);
280
		wkspc->stackingList.push_back(win);
303
	}
281
	}
304
282
305
	Fluxbox::instance()->grab();
283
	XLowerWindow(BaseDisplay::getXDisplay(), st.front());
284
	XRestackWindows(BaseDisplay::getXDisplay(), &st[0], st.size());
306
285
307
	XLowerWindow(screen->getBaseDisplay()->getXDisplay(), *nstack);
308
	XRestackWindows(screen->getBaseDisplay()->getXDisplay(), nstack, i);
309
310
	Fluxbox::instance()->ungrab();
311
312
	delete [] nstack;
313
}
286
}
Lines 810-811 Link Here
810
	win->configure(place_x, place_y, win->getWidth(), win->getHeight());
783
	win->configure(place_x, place_y, win->getWidth(), win->getHeight());
784
}
785
786
787
void Workspace::raiseAndFillStack(Stack::iterator &stackit, const FluxboxWindow &w) {
788
	if (w.getTransients().empty())
789
		return;
790
791
	std::list<FluxboxWindow *>::const_iterator it = w.getTransients().begin();
792
	std::list<FluxboxWindow *>::const_iterator it_end = w.getTransients().end();
793
	for (; it != it_end; ++it) {		
794
		*stackit++ = (*it)->getFrameWindow();
795
		
796
		screen->updateNetizenWindowRaise((*it)->getClientWindow());
797
798
		if (! (*it)->isIconic()) {
799
			Workspace *wkspc = screen->getWorkspace((*it)->getWorkspaceNumber());
800
			wkspc->stackingList.remove((*it));
801
			wkspc->stackingList.push_front((*it));
802
		}
803
804
		
805
	}
806
	
807
	it = w.getTransients().begin();
808
	for (; it != it_end; ++it)
809
		raiseAndFillStack(stackit, *(*it));
810
	
811
812
}
813
814
void Workspace::lowerAndFillStack(Stack::iterator &stackit, const FluxboxWindow &win) {
815
	if (win.getTransients().empty()) // nothing to lower and stack
816
		return;
817
818
	std::list<FluxboxWindow *>::const_reverse_iterator it = win.getTransients().rbegin();
819
	std::list<FluxboxWindow *>::const_reverse_iterator it_end = win.getTransients().rend();
820
	for (; it != it_end; ++it)
821
		lowerAndFillStack(stackit, *(*it));
822
	
823
	it = win.getTransients().rbegin();
824
	
825
	for (; it != it_end; ++it) {
826
		(*stackit) = (*it)->getFrameWindow();
827
		++stackit;
828
		screen->updateNetizenWindowLower((*it)->getClientWindow());
829
		if (! (*it)->isIconic()) {
830
			Workspace *wkspc = screen->getWorkspace((*it)->getWorkspaceNumber());
831
			wkspc->stackingList.remove((*it));
832
			wkspc->stackingList.push_back((*it));
833
		}
834
	}
835
811
}
836
}
(-)fluxbox-0.1.11/src/Workspace.hh (-1 / +4 lines)
Lines 44-46 Link Here
44
	typedef std::vector<FluxboxWindow *> Windows;
44
	typedef std::vector<FluxboxWindow *> Windows;
45
	
45
	typedef std::vector<Window> Stack;
46
46
	Workspace(BScreen *screen, unsigned int workspaceid = 0);
47
	Workspace(BScreen *screen, unsigned int workspaceid = 0);
Lines 101-102 Link Here
101
	
102
	
103
	void raiseAndFillStack(Stack::iterator &it, const FluxboxWindow &win);
104
	void lowerAndFillStack(Stack::iterator &it, const FluxboxWindow &win);
102
105
(-)fluxbox-0.1.11/src/fluxbox.cc (-2 / +2 lines)
Lines 1244-1246 Link Here
1244
				screen->nextFocus(key->getParam());
1244
				screen->nextFocus(key->getParam());
1245
				if (focused_window)
1245
				if (focused_window && focused_window->getTab())
1246
					focused_window->getTab()->raise();
1246
					focused_window->getTab()->raise();
Lines 1249-1251 Link Here
1249
				screen->prevFocus(key->getParam());
1249
				screen->prevFocus(key->getParam());
1250
				if (focused_window)
1250
				if (focused_window && focused_window->getTab())
1251
					focused_window->getTab()->raise();
1251
					focused_window->getTab()->raise();
1252
1252

Return to bug 7717