What counts has "having enough material to mate"? I'm aware that if one's flag falls then the game is declared a win for the opposing side if something like &quot;they have enough material to mate&quot; or &quot;it is possible to mate&quot;. I'm curious about an edge case which actually differentiates between the above two scenarios, i.e. the opposing side has enough material to mate but it's impossible to mate from that position (for whatever reason).
I think an example would illustrate best the situation I had in mind. Suppose White has a King on a1 and a Queen on a2, while Black only has a King on h1. If White then plays Qh2+ (perhaps in an online bullet game) and Black's flag falls, does White win? Note that from this position it is impossible for White to mate, since Black's only legal move here is to play Kxh2, which would be an immediate draw.
There are other scenarios which would be impossible to mate, e.g. if White has a King on a1, pawns on a4, c4, e4, g4, and Black has a King on h8, pawns on a5, c5, e5, g5 -- clearly neither side can mate from this position. (This sort of situation is slightly less interesting to me as this is position that is less likely to arise than the one described above, but I'm still curious.)
From FIDE Laws of Chess, article 5.2b:

The  game  is  drawn  when  a  position  has  arisen  in  which  neither  player  can  checkmate the opponent’s king with any series of legal moves. The game is said to end  in  a  ‘dead  position’.  This  immediately  ends  the  game,  provided  that  the  move  producing the position was legal. (See Article 9.6).

In your first example, as soon as White plays Qh2+, the statement &quot;a  position  has  arisen  in  which  neither  player  can  checkmate the opponent’s king with any series of legal moves&quot; becomes true. As the rule says, this immediately ends the game with a draw. This happened on White's move and it immediately ends the game, so there is no time for Black's flag to fall.
The same happens in your second example. As soon as a dead position arises, it is a draw.
The position does not need to be dead for a fallen flag to result in a draw. Article 6.9 says:

Except  where  one  of  the  Articles:  5.1.a,  5.1.b,  5.2.a,  5.2.b,  5.2.c  applies,  if  a  player  does  not  complete  the  prescribed  number  of  moves  in  the  allotted  time,  the  game  is  lost  by  the player. However, the game is drawn, if the position is such that the opponent cannot checkmate the player’s king by any possible series of legal moves.

So if Black's flag falls and there is no legal sequence of moves that results in Black's king being checkmated, it is a draw. For example, if Black has an extra queen in your first example, and Black's flag falls after this move
[FEN &quot;8/8/8/5q2/8/8/Q7/K6k w - - 0 1&quot;]

1. Qh2+

then it is still a draw, because there is no legal sequence of moves can result in Black's king being checkmated.